2006-03-10

Rcss Changes

Rcss is going through a major rework. It has been Enginised and right now supports server-side includes.

You can include a file in your CSS files with following statement:


@server include(common.css)

All constants from included file are evaluated so it is a perfect way to provide common values for several CSS files.

Code is currently available in Subversion repository: svn://rubyforge.org/var/svn/rcss/trunk/rcss

You need to have Engines plugin installed and following route added to your routes.rb:


  map.connect('stylesheets/:id', :controller => 'stylesheets', :action => 'show')

Then just move your CSS files from public/stylesheets to app/views/stylesheets

2 comments:

Mat Schaffer said...

I took a look at the new RCSS engine. Great stuff. The installation notes should be updated to reflect the engine procedure though. Took me a little while.

My standing question now is why do you do:
template = template.to_s.gsub!(/\.css$/, '')

in the controller? I'd rather not munge the .css extension if it doesn't cause a problem. Why not make an RCSS file end in .rcss, right? Does IE perhaps ignore the content-type and cause .rcss files to be treated as text/plain?

Mat Schaffer said...

Wait... maybe I see. I can still use stylesheet_link_tag this way.

Good job :)

What about changing line 23 of the controller to:
render(:action => template+".rcss", :type => 'css')

so we can name the css files a little more appropriately?