Rails 3.1 - update SCSS variable value?

I installed the [object] .css.scss styleset in my resources / stylesheets directory to fit different views in my application. Each sheet includes a set of global style variable values ​​in the first row:

@import "branding.css.scss";

And then it accesses the values ​​of the variables when necessary ($ primaryColor, $ secondaryColor, etc.) throughout the library.

This is beautifully dry, but unfortunately Rails does not update the object stylesheets when I make changes to the values ​​of the variables in the _branding.css.scss file. I need to touch each file before SCSS recompiles the object style library with the updated variable value.

This is a minor issue, but it undermines the workflow, especially when I continue to clear my browser cache trying to fix it: /

Is there a better way to organize variables?

Is there a way to force update?

+5
source share
2 answers

I put variables and mixins in a file includes.css.scssand imported them into each stylesheet that required them. To recompile Rails when changing the include file, you need to use the directive depend_onin application.js. For instance:

application.css

/*
   *= depend_on includes
   *= require_self
   *= require stylesheet
*/

includes.css.scss

$bg-color: #999;

stylesheet.css.scss

@import "includes.css.scss";

body { background: $bg-color; }
+3
source

This is really very annoying ...

, , , , "application.css.scss", .

- -livereload, 3.1. , - , application.css.scss?

+1

All Articles