Maybe I'm confused on how SASS/SCSS works within Rails (2.3.8.) but I was under the impression that if I included the option
Sass::Plugin.options[:always_update] = true
that whenever I changed my SCSS file and then hit the page (controller) again, the SCSS would recompile.
I can't seem to get this to work, and can't seem to find a good tutorial / example for it. I'开发者_运维问答ve tried setting the above property in the Environment.rb file, but it didn't seem to do anything. I tried putting it in its own initializer with require 'sass' but that doesn't seem to work either.
What am I missing? Or am i just forced to keep a terminal open with a sass --watch command running to be able to rapidly debug / change my styles?
thx
I'm using rails 3.1, but had the same issue. In the sass-rails gem, the docs say
:always_update - This option is not supported. Sprockets uses a controller to access stylesheets in development mode instead of a full scan for changed files.
which could explain why your :always_update
option wasn't working.
For my problem, it was pretty much because I had config.action_controller.perform_caching
in development.rb set to true (to fix some other bug in an old gem). So to fix it I changed it to:
# config/environments/development.rb
config.action_controller.perform_caching = false
Make sure you run compass init
in your rails project. It will set up the following:
- config/compass.rb
- config/initializers/compass.rb
You should reload a normal View of a Controller instead of just the stylesheet directly.
btw, as the documentation says :always_update
updates the css files on every controller reload:
Whether the CSS files should be updated every time a controller is accessed, as opposed to only when the template has been modified. Defaults to false. Only has meaning within Rack, Ruby on Rails, or Merb.
I had the problem, that I name my files ends with .css.scss. After just using .scss it works.
精彩评论