-
Notifications
You must be signed in to change notification settings - Fork 788
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sprockets 4.0: alternative CSS processors? #661
Comments
in sprockets 4 sassc is the default transformer. sass gem should still work, but you have to register it manually 33d0a6f note that sass gem is no longer maintained https://sass-lang.com/blog/ruby-sass-is-deprecated :yui is just a compressor, but you still need a for now, sassc is the only reasonable option |
I guess, there's no (at least clean) way to replace it entirely hacky ways
note that sprockets gem is not maintained anymore, so even if you fix the code by yourself, there's little chance I'll ever be released. if your intention is just to switch back to the original sass gem, just forget about it, it doesn't worth the effort. |
@ahorek I deleted my previous comment since I figured out that I was actually seeing asset caching, not a failure to recognize my registered processor. Calling Thanks for the information that Sprockets isn't maintained any more — I knew that JavaScript integration in Rails had moved over to Webpack but most of the Rails documentation and discussion I've seen seems to at least imply that Sprockets is still the preferred solution for CSS. (My one attempt at using Webpack for both I found it so brutally slow to recompile SCSS in development that I was hoping to switch back.) At any rate, knowing that, I'm not likely to put any more effort into my |
WOW, thank you for letting me know about this project! Someone finally did it. A complete wrapper in Sprockets should be trivial and this could be a real maintained alternative to the sassc gem. btw: I did a quick benchmark, dart-sass is about 20% slower than sassc, which is expected and actually better than I thought. |
@ahorek For my gist to really to become a first-class implementation, somebody would have to go through the dart-sass configuration options and map them to Sprockets configs, make sure more complex scenarios work like importing SCSS from vendor stylesheets (e.g. bootstrap, jQuery, whatever), etc. I don't have the bandwidth to do that, but if this is useful to someone who does, that's great. Also sass-contrib/sass-embedded-host-ruby#2 is fixed now, so that's good. I think that project is where most of the real work is that makes this possible, honestly, and it's only a few months old, so I'm not surprised the Sprockets implementation hasn't been done till now. |
A drop-in solution that replaces sassc with sass-embedded (dart-sass-embedded): https://github.com/ntkme/sassc-embedded-shim-ruby |
If you want to use Sass, you can use https://github.com/rails/dartsass-rails. Seems to be the new preferred way to integrate Sass into a Rails application. I ran into the same issue when trying to use dartsass-rails. The solution was to remove any referenced CSS files from the manifest file ( |
Yes, You can register alternative CSS processors, you just need to do it using https://github.com/rails/sprockets/blob/main/lib/sprockets.rb#L172-L173 |
Thanks @ntkme! |
Is it still possible to use a different CSS processor than SASSC on Sprockets 4.0? It looks like Sprockets will try to load
sassc
even when an alternative processor is specified. When I try to use either:yui
or:sass
, I get the following error:Sprockets environment:
Example app
As you can see I'm trying to get this to run with gollum, which uses sinatra and not Rails. Example branch: https://github.com/repotag/gollum/tree/sprockets-example
To run:
bundle install && bundle exec gollum path/to/repo
, visithttp://127.0.0.1:4567
The text was updated successfully, but these errors were encountered: