Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Always enable digest and compile in the Rake task #2768

Merged
merged 1 commit into from

6 participants

@guilleiguaran

No description provided.

@josevalim josevalim merged commit d6a0078 into from
@josevalim
Owner

Thanks man! Are those things being merged into master as well? :)

@josh
Collaborator

I don't see why we need this. Sounds like people aren't running the precompile task with RAILS_ENV=production.

config.assets.digest isn't necessary since is default to true for production env but config.assets.compile is false by default for production env and it's causing problem to some users that are using erb to get assets url inside css and js files. See #2765

@spohlenz

Since it is possible to have config.assets.digest set to false in production, assets:precompile should probably not hard-code it to true.

Instead the filename should be set based on the value of config.assets.digest. Something like:

filename = target.join(config.assets.digest ? asset.digest_path : logical_path)

Although the manifest needs to update too... I'll submit a pull request.

@betelgeuse

It would be nice if assets:precompile was covered by the test suite so we could avoid regressions in the future.

@tarikjn

@betelgeuse I second that. I may have uncovered a related issue that is still on the 3-1-stable branch: #2805 (comment)

@spohlenz

@betelgeuse, @tarikjn: The assets:precompile rake task does have some tests but they're in railties/test/application/assets_test.rb rather than within ActionPack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 31, 2011
  1. @guilleiguaran
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 2 deletions.
  1. +3 −2 actionpack/lib/sprockets/assets.rake
View
5 actionpack/lib/sprockets/assets.rake
@@ -13,8 +13,9 @@ namespace :assets do
# Ensure that action view is loaded and the appropriate sprockets hooks get executed
ActionView::Base
- # Always perform caching so that asset_path appends the timestamps to file references.
- Rails.application.config.action_controller.perform_caching = true
+ # Always calculate digests and compile files
+ Rails.application.config.assets.digest = true
+ Rails.application.config.assets.compile = true
config = Rails.application.config
env = Rails.application.assets
Something went wrong with that request. Please try again.