Reputation: 165
So we have an app made with rails that we are we are deploying to Heroku. We have been having very odd CSS, JS issues on the heroku build of our app. The CSS and JS are being put into one file when compiled. Is there any way to keep sprockets from concatenating my CSS and maybe even JS files, but still compile? Thanks
Sprockets concatenates all JavaScript files into one master .js file and all CSS files into one master .css file.
Upvotes: 0
Views: 429
Reputation: 3465
Yes, you can individually compile your assets by
1) Adding each individual file to you the Rails.application.config.assets.precompile
array
2) Referencing each JS/CSS file with a javascript_include_tag
or stylesheet_link_tag
3) Removing the sprocket references in you application.js
& application.css
files
Ultimately, you'll be going against best practice of providing a single, larger, JS/CSS files (slower load time), and this will be more difficult to maintain.
Alternatively, I'd suggest you sort out the issues you mentioned by correcting your load order within your application.js/css
files such that they can be concatenated correctly without errors.
Upvotes: 1