sstephenson/sprockets — Issue #243: Backwards compatibility for javascript_include_tag and stylesheet_link_tag
Author: mhoran
Created: 2011-11-15 22:40:17+00:00
State: open

We've recently switched over to Sprockets with Rails 3.1 asset pipeline to manage our CSS compilation. One of the major sticking points, however, has been the lack of backwards compatibility of javascript_include_tag and stylesheet_link tags for assets which haven't, or won't, be moved into the asset pipeline.

It seems to make sense to me that Sprockets should first try the asset pipeline, and if this fails (in production, if the asset isn't precompiled, or some other way in development), it should fall back to looking in the public folder.

We were hit by this after rolling out the asset pipeline and noticing that a number of our other JavaScripts were still cached after the rollout. Turns out this is because the previous mechanism of linking to an asset with a unique timestamp was no longer supported, since Sprockets overrides javascript_include_tag. So, in replacing the relative JavaScript path with an absolute one, none of the precompiled (though non-Sprockets managed assets) had timestamps anymore.