Ruby on Rails JavaScript and CSS Assets
Created: 17 April 2012 Modified:Learned today that CSS and JavaScript Assets in Rails 3 are minified automatically for you. Additionally the application.js and application.css can take “require” statements and include any JavaScript into one file called application.js or application.css. I am guessing the logic here is that fewer javascript includes makes for faster page loading. An example is shown below.
mysecurity/app/assets/javascripts/application.js
The “//= require jquery” includes the jQuery JavaScript APi which is included as a gem file. The “//= require_tree .” seems to include all javascript files into the page. I will be taking out the require_tree which was placed in as default.
tags: