Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails Assets - 404 with .map extension

I am getting the following error for several of my assets in my Rails app.

ActionController::RoutingError (No route matches [GET] "/assets/jquery-1.10.2.min.map")

Can anyone shed some light on where the ".map" is coming from and why? Thanks in advance.

like image 719
user2580174 Avatar asked Aug 23 '13 00:08

user2580174


People also ask

How do you Precompile an asset?

To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.

What is Require_tree?

The require_tree directive tells Sprockets to recursively include all JavaScript files in the specified directory into the output. These paths must be specified relative to the manifest file.

What does rake assets Clean do?

rake assets:clean Only removes old assets (keeps the most recent 3 copies) from public/assets . Useful when doing rolling deploys that may still be serving old assets while the new ones are being compiled.

What are rails sprockets?

Sprockets is a crucial Ruby library that is used to serve and compile web assets. However, in Rails 7.0 the library becomes an optional dependency unless the application needs to use Sprockets. In such situations, the sprockets-rails gem will have to be added to the Gemfile .


1 Answers

It's related to the new source map support that started shipping in jQuery 1.9RC1.

You can either follow the directions from the 1.9RC1 link and add the compressed, uncompressed, and map files to your vendor/assets directory or remove the source map line from the uncompressed file (it looks like //@ sourceMappingURL=jquery-1.10.2.min.map).

Hope that helps.

like image 147
Adam Tanner Avatar answered Dec 08 '22 00:12

Adam Tanner