rails/rails — Issue #3715: javascript_include_tag does not add '.js' extension to sources that contain a '.'
Author: jasonhutchens
Created: 2011-11-22 03:20:41+00:00
State: open

We've just hit this in production in 3.1.1.

The problem is that `Sprockets::Helpers::RailsHelper::AssetPaths.rewrite_extension` does not append the '.js' extension to the source unless `File.extname(source).empty?`

Obviously the fix for us is trivial; just manually add the '.js' extension. However, this is counter-intuitive, as manifest files such as the one below work just fine without needing to be explicit about the extension:

`ruby
//= require jquery.autocomplete
//= require jquery.form
//= require jquery.remotipart
//= require jquery.placeholder
`

Perhaps the extension could be added if `File.extname(source) != ext`, or perhaps `javascript_include_tag` could try both versions (with and without the extension), and fail only if both aren't present?