开发者

Rails Routing INSIDE CSS

Is there any way I can route assets inside of my css to where the rest of the views are pulling them? I mean, inside the CSS can I call url_for or css_for or something like that in order to 开发者_开发问答have the images go through the assets router?

Thank you in advance!


You can use a controller action to render your CSS (with an erb template) and set the content type to text/css.

Take a look at this blog post from Josh Susser on dynamically generated stylesheets. It is from 2006 but the technique described is still applicable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜