I have all the javascript files under app/assets/javascripts
Some of the javascript files
- application.js
- effect.js
- rails.js
- prototype.js
- scriptaculous.js
When pre compiling assets rake assets:precompile it creating application.js in public/assets
But the application.js file included only the content present in app/assets/javascript/application.js ,not including other js file contents(efect,prototype).
If I add javascript files to config.assets.precompile like this
config.assets.precompile += %w( rails.js menu.js )
this create separate js file for each in public/assets
In my production.rb file
# Disable Rails's static asset server (Apache or nginx will already do this)
config.serve_static_assets = true
# Compress JavaScripts and CSS
config.assets.compress = true
I need to combine all javascript files into singlefile.
I’m using prototype.
Anything I am missing?
On
application.jsyou have to include the files you want to combine adding this in the beggining:or if they are all in the same folder
Then in your application you must include tags only for application.js, not for each one.