komposable / komponent

An opinionated way of organizing front-end code in Ruby on Rails, based on components

Home Page:http://komponent.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong import css in component generator

florentferry opened this issue · comments

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";
    """