I haven't found how to enable them on the development log but can achieve the same thing by using sass --watch.
Here is my application.css.scss which mostly pulls other sass files using sass @import (not sprockets *=require. see here for why.) for shared variables/mixins/functions usage:
/*
*= require_self
*= depend_on projects
*/
@import "layout.css.scss";
@import "projects.css.scss";
Now suppose layout.css.scss has this variable:
$main-color: #327B31;
I can get its value in file project.css.scss
@debug "Main color is:" $main-color;
@warn "Darker: " darken($main-color, 20%);
I open up a terminal window and point sass --watch at the main .scss file that pulls in the others
$ sass --watch app/assets/stylesheets/application.css.scss --stop-on-error --trace
>>> Sass is watching for changes. Press Ctrl-C to stop.
>>> Change detected to: /home/yuval/ws/books/railscasts/268-sass-basics/app/assets/stylesheets/projects.css.scss
app/assets/stylesheets/projects.css.scss:5 DEBUG: "Main color is:" #327b31
WARNING: "Darker: " #143214
on line 6 of app/assets/stylesheets/projects.css.scss
from line 16 of app/assets/stylesheets/application.css.scss
overwrite app/assets/stylesheets/application.css.css
--stop-on-error
is because errors tend to make sass --watch retry repeatedly which I don't want. --trace
gives you a backtrace if an error happens.
So long as an error doesn't happen, this log will continue to refresh with each save.
I like this approach also because it's ruby/rails neutral (which it should be, it seems ) and so works with anything running sass.
Also, this works if you are using Compass on top of Sass.
Just activate compass in your application.css.scss file (or whichever .scss file):
@import "compass";
and then use ``compass watch```:
$ compass watch app/assets/stylesheets/application.css.scss --css-dir tmp/cache/
--css-dir tmp/cache/
is to avoid compass watch creating .css files that override your .scss ones. I dump them into the cache with this.