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

Generate scss files without sass-rails #76

Closed Joralf closed 6 years ago

Joralf commented 6 years ago

Hi there!

In #28 you've added generation of scss files by using to the Rails.application.config.generators.stylesheet_engine variable.

I think (correct me if I'm wrong!) this only works because a default Rails app comes with sass-rails. When using webpacker + komponent this library seems obsolete as webpacker will compile my scss into css and the whole assets pipeline is skipped.

Without sass-rails however Rails will not generate scss files, even if the generator is correctly set, i.e. Rails.application.config.generators.stylesheet_engine = :sass

Wouldn't it be better to also give the possibility to generate .scss files in a different way? Or would this be an issue that Rails itself has to solve? I.e. generators should be able to generate scss files without sass-rails if there is a proper loader installed for Webpack?

florentferry commented 6 years ago

Hello @Joralf,

No, you're right. Maybe we can add a configuration option to choose between css, scss or sass as we do for stimulus or locale. We only use the stylesheet_engine variable to detect the syntax used by user, not for generation.

Spone commented 6 years ago

I agree we could add a configuration option. It's also an issue when a project use both scss and css concurrently, and you want to force komponent to generate css files (instead of scss).

Feel free to make a PR!

Joralf commented 6 years ago

I'll have a look if I can put something up in the next few days.

Spone commented 6 years ago

@Joralf can you try the 2.0.0.pre.1 branch and let us know if it works for you?

Joralf commented 6 years ago

@Spone : Works like a charm, thanks!

FIY: I'm not really experienced with contributing to gems, so sorry for not contributing, I just didn't know where to start. Surprised by the simplicity of the code though, so I'll try to keep up to date with the PR's and see if I can contribute to different issues later.

Spone commented 6 years ago

Don't worry, I'm a beginner at working on open source gems as well :)