In the Rails docs for the asset pipeline, it states:
The default behavior in Rails 3.1 and onward is to concatenate all
files into one master file each for JS and CSS. However, you can
separate files or groups of files if required (see below)
How exactly do you separate the files into groups as indicated? For example, if I’ve got an application that also has an admin area, I’d like to create three compiled files:
shared.css (both front- and back-end use this)
application.css (front-end only)
admin.css (back-end only)
The default combines all my files into application.css.
Apparently, my reading comprehension is quite lacking (tl;dr). It seems that when you use
I looks to app/assets/stylesheets/application(css|sass) for a manifest file that defines which sheets to include.
So I can just use
In my back-end to look for that manifest. So here’s how my assets structure ends up looking:
admin.css and application.css are my manifests, and they look like this respectively:
You can see that each just references the shared sheets and then requires the context-specific sheet.