[Rails] Re: Using register_template_handler to serve CSS files (Making ActionView handle .css as .rhtml)

Iván Vega Rivera
2006-01-22T15:44:43Z

Thanks Alain, it looks very interesting, specially the server-side
constants, which are something that I was looking to implement using
plain old  erb code.

However, since you mention some problems with it, I''ll just keep an eye
on it for future usage. Right now, I went with this:

        tpl = ''''

File.open("#{RAILS_ROOT}/app/views/styles/#{params[''cssfile'']}")
do |css|
            while line = css.gets
                tpl += line
            end
        end
        render_template tpl

Regards,
Ivan V.

Alain Ravet escribi?:
> Iv?n
>
>    >  I wanted to be able to use some Rails code inside CSS files,
>
> Do you know RCSS?
>     http://rcss.rubyforge.org/
> It lets you use Erb inside css stylesheets.
>
> Note: I''ve experienced some problems when using RCSS on a shared
> server (Dreamhost). I wonder if it''s related to RCSS resource
need:it
> has to translate the RCSS file into a CSS one. What happened is that
> the page would sometimes render without any styling, as when you
> remove all the stylesheed. Refreshing the page would have display
> correctly.
>
>
> Alain
>
> _______________________________________________
> Rails mailing list
> Rails@lists.rubyonrails.org
> http://lists.rubyonrails.org/mailman/listinfo/rails
>