Generating stylesheets for Rails

81 views
Skip to first unread message

Tom Stuart

unread,
Feb 5, 2009, 5:10:43 AM2/5/09
to ha...@googlegroups.com
Hi,

It'd be handy for my deployment process to be able to generate all of
my stylesheets from Sass before any mongrels have a chance to start
up, not least because my "down for maintenance" page uses these
stylesheets. I've seen people talking about a haml:compile_sass task
in the context of Merb; does there already exist a comparable rake
task for Rails that I can get Capistrano to kick off at the right time?

Cheers,
-Tom

Nathan Weizenbaum

unread,
Feb 5, 2009, 6:06:34 AM2/5/09
to ha...@googlegroups.com
There's no built-in Rake task for it, but if you run "Sass::Plugin.update_stylesheets" via script/runner that should do it.

scottwb

unread,
Feb 5, 2009, 1:11:57 PM2/5/09
to Haml
Some time ago I ended up writing a small script that just traversed my
stylesheets directory tree calling the 'sass' command line tool on all
the .sass files, and invoked that script from a capistrano task as
part of deployment. That definitely works, but I like the sound of
this update_stylesheets method.

One thing I am not clear on is if Sass::Plugin.options (such
as :style) will be honored using this method.

Nathan Weizenbaum

unread,
Feb 5, 2009, 6:27:19 PM2/5/09
to ha...@googlegroups.com
Yes, if Sass::Plugin.options is properly set, it will be updated. It might be tricky to get it set in the right way in Rails, though.

Chris Eppstein

unread,
Feb 5, 2009, 8:11:39 PM2/5/09
to ha...@googlegroups.com
I do it like this for my website:

http://gist.github.com/59147

NOTE: This will only update those files where the sass file is newer than the corresponding css.

chris
Reply all
Reply to author
Forward
0 new messages