rails / cssbundling-rails

Bundle and process CSS in Rails with Tailwind, PostCSS, and Sass via Node.js.
MIT License
563 stars 83 forks source link

Suggest defining config.assets.css_compressor = nil #129

Closed sedubois closed 6 months ago

sedubois commented 10 months ago

We are migrating our project away from sassc-rails towards cssbundling-rails with sass (and in preparation for introducing tailwind in parallel with that while we rewrite everything), however we still use administrate which as of writing still depends on sassc-rails.

At first we defined config.assets.css_compressor = nil by uncommenting the line in config/environments/production.rb, but only later realized this did not affect the test environment, which is the reason why our test suite was still failing with errors such as ActionView::Template::Error: Error: Function rgb is missing argument $green, and I believe other seemingly incomprensible errors such as ActionView::Template::Error: Asset X was not declared to be precompiled in production even though they were included in the Sprockets manifest. Perhaps this PR will prevent someone else from encountering the same misfortune.

Additional idea: how about having the gem raise a warning if config.assets.css_compressor is not nil?

gregnavis commented 6 months ago

@sedubois, thank you for this PR. I've been struggling with exactly this problem on the project that I migrating from Bulma to Tailwind. Additionally, it uses administrate. My only question is whether this specific error message you mentioned, which I also experienced, is the only way in which the problem can manifest itself.