Skip to content

Commit

Permalink
Merge pull request #71 from andrzejsliwa/align_generated_js_with_airb…
Browse files Browse the repository at this point in the history
…nb_linter

Align generated js with airbnb linter
  • Loading branch information
florentferry committed Mar 5, 2018
2 parents 58928e0 + 0cd26d8 commit 941f594
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/generators/component/templates/js.erb
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import "./<%= name_with_namespace %>.<%= stylesheet_engine %>";
<%- if stimulus? -%>
import application from "stimulus_application";
import { definitionsFromContext } from "stimulus/webpack-helpers";
import "./<%= name_with_namespace %>.<%= stylesheet_engine %>";

const context = require.context('./', true, /_controller\.js$/);
application.load(definitionsFromContext(context));
<%- else -%>
import "./<%= name_with_namespace %>.<%= stylesheet_engine %>";
<%- end -%>
6 changes: 4 additions & 2 deletions lib/generators/komponent/install_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,13 @@ def install_stimulus
protected

def stimulus_application_template
<<-HEREDOC
<<-JAVASCRIPT
import { Application } from "stimulus";
const application = Application.start();
export default application;
HEREDOC
JAVASCRIPT
end

def stimulus_application_path
Expand Down

0 comments on commit 941f594

Please sign in to comment.