sass / sassc-rails

Integrate SassC-Ruby with Rails!
MIT License
707 stars 103 forks source link

SassC attempts to process each partial individually #157

Closed Taeir closed 3 years ago

Taeir commented 3 years ago

I'm currently in the process of migrating from sass-rails to sassc-rails.

I get an error on the first stylesheet (alphabetically) _alert.bootstrap.scss because the value of a variable which is defined in _settings.bootstrap.scss cannot be found:

ActionView::Template::Error (Error: Undefined variable: "$border-radius-base".
        on line 2:45 of app/assets/stylesheets/_alert.bootstrap.scss
>> lert-border-radius:                       $border-radius-base !default;

   ------------------------------------------^
):

app/assets/stylesheets/_alert.bootstrap.scss:2

Instead of loading all the partial files individually, I expect sassc to load the application.scss which has:

@import 'settings.bootstrap';
@import 'alert.bootstrap';

And thus the required variables should be made available by the first import.

For context, the stylesheets are being compiled as a result of the following call:

<%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>

Is there something I am doing wrong?

Taeir commented 3 years ago

I have found a solution for the problem. I'm not sure if something changed in the asset pipeline, but all the files in the link_directory as specified by the manifest (i.e. assets/stylesheets) will be processed as stand-alone files and compiled, even if these are partials. Moving all partials into a subdirectory and updating the imports fixes the problem.

I will close this issue.