I have two questions.
Am I making a wrong assumption that all my javascripts should be compressed into application.js by default in rails 3.1 even in development mode?
If not, then why does my tag have all 30 of my javascripts and take forver to load?
My application.js file looks like this:
//= require jquery
//= require jquery_ujs
//= require jquery-ui
//= require_tree .
And in the browser it is rendered as:
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
;
While all my other javascripts are rendered in full.
Thank a bunch!
If this is a new Rails app debug mode is on by default. Debug mode tell Sprockets to write tags for each file into the HTML source. This is done to facilitate source file debugging.
If you want to have just one file in development mode go to your development.rb and set:
config.assets.debug = false
This will give you one file for each manifest.
Compression is NOT on by default for development, but if you wanted that too, then set:
config.assets.compress = true
And you will need to move the compressor options from production.rb to application.rb so they are accessible to the development environment.
I turn debug off in dev mode, but I don't use compression because of the extra time it takes to process the files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With