Javascript/CSS asset bundling a prominent feature in Rails 2.0

posted: September 12th, 2007 · by: Sven

in: Programming · tagged as: , , , , , , , ·  2 comments »

Hey, I just noticed that bundled Javascript and CSS assets will be supported natively in Rails 2.0! David even selected this feature as one of those prominent Rails 2.0 features that he presented during his keynote at the RailsConf Chicago 2007 on May 18th.

Actually this stuff even is in Rails Edge ever since February! So in Rails Edge we already can do this:


<%= javascript_include_tag :all, :cache => true %>
<%= stylesheet_link_tag :all, :cache => true %>  

Or more flexibly:


<%= stylesheet_link_tag "shop", "cart", "checkout", :cache => "payment"  %>

That’s cool :)

And it’s pretty much the same what my own Bundled Assets plugin does … besides: my plugin also “compacts” Javascript and CSS by stripping things like comments and whitespace - and it still works on Rails 1.2 of course.

Huh. Wow!

Leave a comment

2 Comments

  1. polypus said October 25th, 2007 at 05:48 AM  

    huh, so i guess the new native to rails version does not do any ‘compression’? does your plugin work on rails 2.0?

    thanks, _c

  2. Sven Fuchs said October 26th, 2007 at 02:07 PM  

    Hi polypus,

    actually, I haven’t tested that, yet. I’d love to learn about your results if you want to give it a try :)

    This blogs runs on a Rails revision 7404 which isn’t that old. Also, I can’t see why it wouldn’t work on Rails 2.0 … but of course, you never really know before you try it.

Leave a comment

Name required
E-Mail and Website optional

If you can read this, you don't use a typical webbrowser that plays nice with CSS.
Please do not fill in anything here!

Hint: Markdown will be applied to your comment. If you post any code, be sure to escape underscores (like so: \_) if you do not want them to be converted to an <em>phasis.

artweb design
Sven Fuchs
Grünberger Str. 65
10245 Berlin, Germany


http://www.artweb-design.de

Fon +49 (30) 47 98 69 96
Fax +49 (30) 47 98 69 97