komposable/komponent

View on GitHub
lib/generators/component/templates/js.erb

Summary

Maintainability
Test Coverage
<%- 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 -%>