Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Ruby

Freddy Heppell
Freddy Heppell
9,753 Points

Pushing treebook to heroku - missing assets

I've deployed the app to heroku but it has lost the bootstrap files. The compiled css file referenced only contains the 40px padding and not bootstrap and my javascripts are missing. Why is this?

6 Answers

Daniel Terreros
PLUS
Daniel Terreros
Courses Plus Student 6,178 Points

If you're using Ruby 2.0.0 and Rails 4, here are the steps I followed to get bootstrap functional

1) Like Gwyn suggessted you have to precompile your assets, but do it on you PRODUCTION ENV. Documentaion here,

RAILS_ENV=production bundle exec rake assets:precompile

git add public/assets

git commit -m "vendor compiled assets"

Also if using rails 4, make sure you add this to your gemfile

gem 'rails_12factor'

then

bundle install

before finally

git push heroku master

documents here That finally had me up and running!

Freddy Heppell
Freddy Heppell
9,753 Points

I've tried changing production.rb settings but that doesn't work

Did you ever get this resolved because I am having the exact same issue.

googled it and found the answer eventually:

I had to run:

rake assets:precompile

before pushing to heroku.

Daniel Terreros
Daniel Terreros
Courses Plus Student 6,178 Points

Heroku logs show no issue with precompiling assets, however i did precompile before pushing, and no improvement.

I have ZERO CSS or Javascript happening.

My links work and so does registration. But no parts of twitter bootstrap are functioning.

Any other ideas?

Aimee Knight
Aimee Knight
9,701 Points

I've also been having this issue on another app. Curious to hear an answer. It was my understanding that Heroku would try to compile assets, and locally compiling them was only a fall back. According to https://devcenter.heroku.com/articles/rails-asset-pipeline, once you do a local compile Heroku can't do slug compilation anymore since your app will have a manifest.yml file. Would love to know what the 'proper' method is.

Parker Busswood
Parker Busswood
20,207 Points

Adding this code right below "source 'https://rubygems.org'" worked for me:

ruby '1.9.3'

Then do a 'git add .', and a 'git push heroku master'