rails / dartsass-rails

Integrate Dart Sass with the asset pipeline in Rails
MIT License
208 stars 43 forks source link

README Suggestion for sassc LoadError #53

Open swillits opened 7 months ago

swillits commented 7 months ago

The README should/could also point out specifically that a reason for receiving

`LoadError: cannot load such file -- sassc`

… is that Sprockets could not find the css file being requested. That could be because:

  1. Rails.application.config.dartsass.builds isn't configured to produce a file with the requested name.
  2. The file wasn't built. (Because dartsass:build wasn't called, or locally dartsass:watch isn't running for example.)

As an example:

<%= stylesheet_link_tag "site" %>

# With the configuration:
Rails.application.config.dartsass.builds = {
    "application.scss" => "application.css",
}

Sprockets will not find the file 'application.css' in any of the locations specified in mainfest.js (it's not in the app/assets/builds folder) and so Sprockets will apparently try to use the sassc part of the pipeline to find and build it the old way. Since sassc isn't installed, that results in a load error.

nimmolo commented 4 months ago

Related to #48