You may have heard of the term "asset pipeline" used in the Rails context and wondered what it was and how to set it up. I've recently read up on the details about it (http://guides.rubyonrails.org/asset_pipeline.html) and had to set up my project to use it, and I'm happy to explain in brief the why and how if you want to just jump right into it.
To take advantage of this, you need to take a few steps. Please note that these are instructions for Rails 3.2, since that is the version my project is currently using. To see the most up-to-date instructions and notes of any updates to the process, please go to the official guide: http://guides.rubyonrails.org/asset_pipeline.html. Tip: for instructions for a specific version, you can add your rails version number into that url, like so http://guides.rubyonrails.org/v3.2.19/asset_pipeline.html
Now let's get on with it!
*= require_tree .to app/assets/stylesheets/application.css.
require_treewill recursively grab your script files and load them in an order you cannot control. If you need to control the order, you can specify the name of your files beforehand with
require [filename without the extension]
config.assets.debug = true. This will stop your asset files from being converted to one huge file when running your application locally, so when you're debugging in the console it'll be easier.
In all of your other environments add the following to your config/environments/[environment_name].rb:
config.assets.digest = true config.assets.compress = true config.assets.debug = false config.assets.js_compressor = :uglifier
run the following in your application's directory, and add it to your deployment script:
rake RAILS_ENV=[environment_name] RAILS_GROUP=assets assets:precompile
And that's it, folks. Please note that I left out a lot of details deliberately so you can get up and running with the asset pipeline fast, but I recommend that you read the official rails documentation on it when you have a chance.