moctopus
moctopus

Reputation: 183

Heroku not displaying (finding?) .css and .js files

I have recently added a project to Heroku. However, none of the .css files or .js files seem to be working.

I am using Twitter's Bootstrap .css and .js files. I have added the files to their respective directories in vendor/assets.

Based on other questions I have seen asked here I upgraded from Bamboo to Cedar on Heroku. I also tried rake assets:precompile RAILS_ENV=production, changing config.assets.enabled = true to config.assets.enabled = false in application.rb, config.assets.compile = false config.assets.compile = true in production.rb, and about as many combinations of the above things as I could think of.

Everything is working fine locally.

(Adding a link to the github in an attempt to provide more information.) https://github.com/moctopus/sixtydays

Upvotes: 3

Views: 3336

Answers (1)

pjumble
pjumble

Reputation: 16960

By default assets:precompile won't process the css/js files in /vendor/assets. In production.rb you can use config.assets.precompile to get additional css/js files processed by the asset precompile.

For example, if you had your twitter bootstrap css/js files inside /vendor/assets/bootstrap use:

config.assets.precompile += %w[ bootstrap/*.css bootstrap/*.js ]

Then rake assets:precompile will process them and they'll work on heroku.


see: http://guides.rubyonrails.org/asset_pipeline.html#precompiling-assets

The default matcher for compiling files includes application.js, application.css and all non-JS/CSS files

Upvotes: 7

Related Questions