0

I'm working with this tutorial and I'm up to the part that says to run

bundle exec rake assets:precompile

If you take a look at the website, you can see that she shows the output from this command and what it should look like. However, I don't get that response. I get the normal compiled files as usual (that needs to be committed and pushed).

new file:   public/assets/bootstrap.min-b90c459188f886cf6a00921016ed2104.css
new file:   public/assets/bootstrap.min-b90c459188f886cf6a00921016ed2104.css.gz
new file:   public/assets/bootstrap_and_overrides-e3193dde7df14df59d8c755dbe743f58.css
new file:   public/assets/bootstrap_and_overrides-e3193dde7df14df59d8c755dbe743f58.css.gz

I check my bucket in S3 and there's nothing there either. I've followed this tutorial to the T so I'm not sure where I've gone wrong, but I would really appreciate someone's help.

Thank you in advance.

EDIT: So I pushed to heroku to see what happens and my asset links changes (my stylesheets link to AWS) but they are still not uploading to the bucket, so of course my site is without styles when this happens. Hopefully this is enough information.

1 Answers1

1

You will want to make sure your AWS keys are in your heroku app. You can check out this tutorial which you have to go to heroku console and type in your keys and it directs it to heroku app.

https://devcenter.heroku.com/articles/paperclip-s3

This link may help as well. https://medium.com/self-directed-learning/rails-4-heroku-the-asset-pipeline-quandary-9ba1f595102a

Also run this command in your terminal before you push and push to heroku. RAILS_ENV=production bundle exec rake assets:precompile

In your config/envirement/production.rb make sure this is true. config.assets.compile = true

You also want to make sure your bucket name is listed in your production.rb along with your keys or in a paperclip or carrierwave file if you are going that route.

looks like the article uses fog.

      config.fog_credentials = {
:provider               => 'AWS', 
:aws_access_key_id      => 'key', 
:aws_secret_access_key  => 'key',

} config.fog_directory = 'bucket_name'

Awhitey98
  • 167
  • 1
  • 2
  • 14
  • Hey, thanks for replying so quickly. My keys are in Heroku as per the tutorials you provided. I ran the command in my terminal, updating my production.rb and listed everything in my production.rb as you suggested. Still, when I precompile it's not uploading to AWS as the original tutorial suggests and when I push to Heroku, my stylesheets are missing again. I'm really stuck (and getting frustrated) with this. – Luchia Bloomfield Sep 08 '14 at 17:55
  • Can you post copies of your production.rb file and the file you have your keys listed in as well? Have you also checked heroku log -t in the terminal to see where the error is coming from? if so can you post that as well? – Awhitey98 Sep 10 '14 at 18:19
  • Okay, I think I worked it out. I had asset_sync in production only group in my Gemfile, so it wasn't compiling to AWS. I followed everything else you said and it worked so I'm going to mark this as answered, thank you so much for your time. – Luchia Bloomfield Sep 16 '14 at 15:47