I upgraded a Rails 3.0 app to Rails 3.1 which involved putting this
/* *= require_self *= require_tree . */
in the application.css file. However, there's an admin.css file that's now overriding the main app css file.
Is there a way to exclude the admin.css file from being included? In the admin section of the site I manually include the admin.css file but I need a way to exclude it from the user interface.
To compile your assets locally, run the assets:precompile task locally on your app. Make sure to use the production environment so that the production version of your assets are generated. A public/assets directory will be created. Inside this directory you'll find a manifest.
rake assets:precompile. We use rake assets:precompile to precompile our assets before pushing code to production. This command precompiles assets and places them under the public/assets directory in our Rails application.
//= require_self. It loads the file itself, to define the order that the files are loaded.
You can use the stub
sprockets' directive in your manifest like this :
/* *= require_self *= require_tree . *= stub admin */
This will exclude admin.css
and also ALL css required in it !! So, if your admin.css
's manifest seems like this :
/* *= require bootstrap *= require_self */
the bootstrap.css
will also be excludes and no require
could fixe this ! Take care of this ;)
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