I didn't invoke any sass command to "watch" the .sass file changes and recompile them into .css (and concatenate all .css into a giant .css file) But somehow, when I modify any .sass file in the Rails project, and reload the page on a browser, the giant .css file already has the updated content. What is the mechanism that does this?
+2
A:
If you have gem 'haml'
in your Gemfile, it's that.
The gem's init.rb file gets run which calls Haml.init_rails
, and you can follow the thread from there pretty easily.
rspeicher
2010-10-27 23:23:48
does it happen per page request or per partial? our page takes 30 to 40 seconds to render, I am not sure why the 3ms, 12ms partial render time all add up to feel like 5 seconds (it could be controller code too)
動靜能量
2010-10-27 23:26:45
I'm not positive but it should be per-request (similar to way Rails reloads classes). In your original post you say "giant .css file" - how "giant" are we talking? In my projects that use Sass, the re-compile times are negligible, so I'd be surprised if this is causing slow loading for you.
rspeicher
2010-10-27 23:30:17
It's not per page request per se. It's everytime the sass file changes, and of course never when you run your app with RAILS_ENV set to production.
Hugo
2010-10-28 00:38:48
Yeah, it wasn't clear but that's what I meant - each request it checks for Sass changes. It's not constantly polling the filesystem, or something.
rspeicher
2010-10-28 04:12:06