Closed Faq closed 2 years ago
Try removing the //= link application.css
line from the app/assets/config/manifest.js
... if that line is there, sprockets assumes it needs to process it with sassc
Same goes for the //= link_directory ../stylesheets .css
if you have it, which is common for new projects to have it.
@vovimayhem, had only //= link application.css, removed and doing precompile, problem is the same.
Perhaps it is because Sprockets 4 processor by default is sassc (dev dependency sassc too)? https://github.com/rails/sprockets/blob/main/lib/sprockets.rb#L172-L173
Found out the problem: As under stylesheets root folder were extra example.scss
file and it was set to precompile with: Rails.application.config.assets.precompile += %w( example.css )
This errors showed because file actually had different extension.
Solution:
Rails.application.config.dartsass.builds = {
"application.scss" => "application.css",
"example.scss" => "example.css"
}
And for production, got
LoadError: cannot load such file -- sass
in config/environments/production.rb
was:
config.assets.css_compressor = :sass
Removing that line works just fine.
@vovimayhem it is not needed, right? Didn't saw this mentioned in documentation.
running
rake assets:precompile
ends with the error. Can't find why it still requires sassc, sassc only was in project when migrated to sprockets 4 using Guide to upgrading from Sprockets 3.x to 4.x:and then followed dartsass-rails install documentation. did:
ruby-3.1.2
manifest.js file content:
error log:
OS: mac
When I install gem with dependency on sassc-rails (example pdfjs_viewer-rails) and start server with
./bin/dev
, then all starts up and works fine.