I prefer not to concatenate JavaScript files in development mode, but serve them as individual files. So I configured:
development.rb:
confi
In config/environments/development.rb
set:
config.assets.prefix = "/assets_dev"
so that in development mode Rails will look there (but it will not find anything, as you will not compile assets in development (this is indeed what you are trying to do -- not compile assets)).
When precompiling for production, use
RAILS_ENV=production rake assets:precompile
so it compiles into the default assets folder, public/assets
.
I tried this and it worked. rake assets:precompile RAILS_ENV=production
I observed that the new version of assets pipeline does this when you run rake assets:precompile
does rake assets:precompile:all
in config/environments/development.rb
set:
config.serve_static_assets = false
and no files from /public
will be served
It sounds like you are precompiling locally. Because the files exist in the expected location they are being served by your dev server, and the requests are not going to Sprockets.
The only way to stop this is delete the compiled files.
Normally you do not need to compile locally. It is expected that in almost all cases the precompile task will be run during deployment of the app. There is a Capistrano recipe for this on the asset pipeline guide page.
If you do need to have those files locally committed to your repo you could use a branch to avoid the problem. Reserve your master branch for production code, and make a second branch for dev. Only compile and commit assets on master. When you switch to dev, they will be gone. Merge dev into master as required.
Edit: Make sure you force your browser to update (control + F5) or you may find the old assets used from the browser cache!