Niels Kristian
Niels Kristian

Reputation: 8835

Rails: How do I force a new asset digest on ALL assets?

Running a rails 4.2 app with sprockets and using asset digests. When running rake assets:precompile it creates all my assets with digests. I need however to bump all asset digests to help me debug some caching stuff in production. I tried changing the assets version in:

# config/initializers/assets.rb
Rails.application.config.assets.version = '6.4'

However running rake assets:precompile again after this is done, does not create new files with new digests. Shouldn't it? Or am I missing out on something?

Upvotes: 1

Views: 1998

Answers (1)

bkunzi01
bkunzi01

Reputation: 4561

I found the only way to force expiration of assets and get them recompiled was to add the following in my config/environments/production.rb

config.assets.version = '1.1' #This currently doesnt work as intended so use
config.assets.prefix = '/production'

Then bundle exec rake assets:precompile RAILS_ENV=production

Rails 4 and Sprockets 3 don't quite get along as per the thread here thus the versioning not working as intended: https://github.com/rails/sprockets-rails/issues/240

Upvotes: 3

Related Questions