Update 06/26/2012
I changed the
asset_tag_helper.rb
and
config/initializers/sprockets.rb
file to be more robust and to support a “debug mode”.
Note:
The sowftware I use to generate this blog (Jekyll) and the code syntax highlighter I’m using
don’t support the
#{}
Ruby style string concatenation. In
ALL
the examples below, I’ve changed instances of
"#{string_one}#{string_two}"
to
string_one + string_two
This will have a few side effects, as Ruby automatically calls
#to_s
on objects when using the
#{}
style concatenation, but not the
+
style. If you run into issues, let me know.
At FutureAdvisor our main app is still in Rails 2.3, mainly because upgrading to Rails 3 is kind of a pain. I generally keep a few side projects around, like MyRoommate, to play around with new technologies. I’ve upgraded MyRoommate to use Rails 3.2 and am absolutely in love with the Asset Pipeline. So I set out to make it work with our Rails 2.3 app at FutureAdvisor.
Here’s what I’ll cover:
- Installing Sprockets and mounting the Rack app
-
Overriding Rails
AssetTagHelper
to be aware of Sprockets specific pathing - Precompiling assets for use in production (and Sprockets manifest files).