tablecheck / dartsass-sprockets

Integrate Dart Sass with Sprockets (Ruby on Rails asset pipeline)
MIT License
35 stars 5 forks source link

`dartsass-sprockets` not noticing changes in secondary `@import` .scss files, with deprecation warnings #26

Open nimmolo opened 2 months ago

nimmolo commented 2 months ago

The issue i'm having is that for the last month or so, my CSS is not getting re-compiled when I alter certain imported scss files. (I don't have any imported .css files — the issue reported in #24 that has a workaround.)

Here is the order of compilation: the app has different themes like theme_one.css that are loaded in the head according to user preferences, instead of an application.css. The scss structure is:

// app/assets/stylesheets/theme_one.scss

// import this theme's variables
@import "custom/theme_one_vars"
// import the whole application
@import "application"
// app/assets/stylesheets/application.scss

@import "bootstrap-sprockets";
@import "custom/map_theme_vars_to_bootstrap_vars"; 
@import "bootstrap";
// Now that bootstrap defaults are themed, set custom SCSS for our elements.
@import "custom/elements";
// etc

The changes i want to make are in custom/elements.scss. But if I only change custom/elements.scss, CSS does not get recompiled. However, if I make my changes to custom/elements.scss and also, experimentally, alter a variable in custom/theme_one_vars.scss - in this case, all of the SCSS is recompiled, reflecting the changes in custom/elements.scss.

It occurred to me that this may be related to scss deprecation warnings. The app still uses Bootstrap 3, but our upgrade migration is a couple months away. Considering the order of imports, this indicates to me that maybe dartsass-sprockets, sprockets or dartsass stops checking for altered files after finding a deprecation warning. But that doesn't quite make sense — in the case where the CSS does get compiled, the compilation proceeds even after the warnings.

(To anticipate a possible question, yes I have run assets:clobber to be sure I don't have precompiled assets!)