komposable / komponent

An opinionated way of organizing front-end code in Ruby on Rails, based on components
http://komponent.io
MIT License
427 stars 31 forks source link

Wrong import css in component generator #33

Closed florentferry closed 6 years ago

florentferry commented 6 years ago

When we use sass or scss stylesheet engine, and we generate component rails g component button, the import './button.css' is always asking css file then than in folder we have scss or sass file.

We have to change that line in both templates/js.erb and templates/stimulus_controller_js.erb.

import "./<%= name_with_namespace %>.css";

to:

import "./<%= name_with_namespace %>.<%= stylesheet_engine %>";

We have to update features in features/component_generator/stylesheet_engine.feature for all scenarios:

    Then the file named "awesome_button/awesome_button.js" should contain:
    """
    import "./awesome_button.[stylesheet_engine]";
    """

And update features/component_generator/stimulus.feature with a check to scss at least:

    Then the file named "awesome_button/awesome_button.js" should contain:
    """
    import "./awesome_button.scss";
    """
    Then the file named "awesome_button/awesome_button_controller.js" should contain:
    """
    import "./awesome_button.scss";
    """