Sylar
Sylar

Reputation: 12072

Application.css not updating in production with heroku

My application.css is not changing when I push to heroku.

rake assets:precompile # does some things
git add-commit -m "..."
git push heroku master

Application.css:

*
*= require foundation_and_overrides
* required other files
*/

body {
 background: red
}

Production env:

config.assets.compile = true
config.assets.digest = true

Nothing works, my background is white even if it's set to red. How does the pipeline works with heroku and rails 5, please?

Upvotes: 0

Views: 530

Answers (1)

bkunzi01
bkunzi01

Reputation: 4561

You need to run bundle exec rake assets:precompile RAILS_ENV=production or it will use your development environment config settings for precompiliation. Also, to force that the fingerprint digest changes I want you to add a comment at the very top of your application.css file so it looks like this:

/assets/stylesheets/application.css
/* Adding a comment to force a new digest and expire cached assets in browsers */

Also, make sure to include the heroku gem for serving assets in your gemfile:

gem 'rails_12factor', group: :production

Also, as a sidenote, you're asking for major performance decreases when setting config.assets.compile = true

You should make sure to find any missing assets and fix the assets paths before deploying to production and keeping the assets.compile=false

Upvotes: 1

Related Questions