I am building my blog and its admin section is significantly different from the rest of the site. So I decided to have separate manifests as per what I understand in the The Asset Pipeline documentation.
Problem:
The admin section works as expected with the styles applied properly. But in production it doesn't. I have run rake assets:precompile
and it only generates one version which is application-[blah].js. and not a admin_lite-[blah].js
What could I be doing wrong? Help is greatly appreciated.
More information
- app/assets/stylesheets/admin_lite.css
- <%= stylesheet_link_tag "admin_lte", media: 'all' %> \
- app/assets/javascripts/admin_lite.js
- <%= javascript_include_tag "admin_lte" %>
- Added initilizer (config/intilizers/assets.rb)
Rails.application.config.assets.precompile += ['admin_lite.js', 'admin_lite.css']
- ran `RAILS_ENV bin/rake assets:precompile
- Only generates some thing like applicaiton-[signature].js && application-[signature].css
- The css and js links in the admin section is as /stylesheets/admin_lite.css /javascripts/admin_lite.css ( not the format it is for application-* varients which have a signature ).
The css output
<link href="/stylesheets/admin_lte.css" media="all" rel="stylesheet" />
<script src="/javascripts/admin_lte.js"></script>
Updates
- added
config.assets.precompile += ['admin_lite.js', 'admin_lite.css']
toconfig/environments/production.rb
(and alsodevelopment.rb
to test) - added
config.assets.precompile += ['admin_lite.js', 'admin_lite.css']
toapplication.rb
with no success
Fix / Resolved
The error was a typo, where I had used the wrong file name and thus it was not compiled. So, if you...
- run
rake assets:precompile
application.css
compiles but not your custom manifest (ex: admin.css)- Check the spelling
- I really wish it to have raised an exception.