Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Makes component_name variable accessible for example generator #159

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/generators/component/templates/examples.html.erb.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<h1 class="komponent-title"><%%= @component.title %></h1>

<%%= cdoc "<%= component_name %>" %>
<%%= cdoc "<%= @component_name %>" %>
2 changes: 1 addition & 1 deletion lib/generators/component/templates/examples.html.haml.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
%h1.komponent-title= @component.title

= cdoc "<%= component_name %>"
= cdoc "<%= @component_name %>"
2 changes: 1 addition & 1 deletion lib/generators/component/templates/examples.html.slim.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
h1.komponent-title= @component.title

= cdoc "<%= component_name %>"
= cdoc "<%= @component_name %>"
1 change: 1 addition & 0 deletions lib/generators/komponent/examples_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def component_path(component_name)
private

def create_examples_view_file(component_name)
@component_name = component_name
template "examples.html.#{template_engine}.erb", component_path(component_name) + "_examples.html.#{template_engine}"
end
end
Expand Down