Chapter 17. Managing Assets and Bundles

Our journey through Rails has been a magical one so far, hasn’t it? Generators that build entire application structures. Validations in one line of code. Object-relational mapping that helps make creating a database schema a breeze. Relationships that make sense.

Is it any wonder that companies like Hulu, LivingSocial, Shopify, 37signals, and many more are using Ruby on Rails to build amazing products? It’s a web developer’s playland, filled with tools to make the process fun and productive.

Much of the joy of building with Rails comes from embracing the limitations it creates. The structure of the framework means you have to figure out how to build your application the way Rails wants you to build it. Unfortunately, for the longest time, Javascript and CSS were treated as “second-class citizens,” shoehorned into the public folder to fight for themselves. Because the framework dictates how you’ll use it, front-end designers had to live with the status quo.

All of that changed with Rails 3.1. In the final three chapters, we’ll examine how changes to the Rails framework finally brought Javascript and CSS into the framework (literally) and what it means for the future of front-end development in Rails.

The Junk Drawer

Prior to Rails 3.1, the public directory served as a “junk drawer” where stylesheets, scripts, images, HTML, text, and other files would live. Got some new pics? Throw them in public/images. Need a print style stylesheet? That went in ...

Get Learning Rails 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.