-
Notifications
You must be signed in to change notification settings - Fork 21.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default config.assets.digests to true in development #15155
Conversation
Cool! Change the Gemfile to point to sprockets-rails master and we run the test suite against it. |
@@ -198,12 +198,9 @@ will result in your assets being included more than once. | |||
|
|||
WARNING: When using asset precompilation, you will need to ensure that your | |||
controller assets will be precompiled when loading them on a per page basis. By | |||
default .coffee and .scss files will not be precompiled on their own. This will | |||
result in false positives during development as these files will work just fine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No longer results in false positives thanks to rails/sprockets-rails#84.
Done! |
From a quick glance at the CI failures, it seems like there are instances in the tests that request assets without their digests and some asserts that expect the non-digested URL (e.g. expecting I'll take a look at turning off the digest flag when appropriate for some of the tests and amending the regex to include a digest for others. |
@@ -342,6 +335,8 @@ class User < ActiveRecord::Base; raise 'should not be reached'; end | |||
end | |||
RUBY | |||
|
|||
add_to_env_config "development", "config.assets.digest = false" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to disable digest for this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, we need to disable it. We make a GET to "/assets/demo.js"
which doesn't work when digests are enabled since a digest isn't included in the request URL.
Could you add a CHANGELOG entry? |
Sure. Do you mean another CHANGELOG entry in addition to the one already added to |
Oops, it is there already. thanks. |
Default config.assets.digests to true in development
Thanks @rafaelfranca and @matthewd for your help in getting this and rails/sprockets-rails#149 done! |
With rails/sprockets-rails#149, assets will only be served if the request has a digest if
config.assets.digest = true
andconfig.assets.raise_runtime_errors = true
.This PR sets
config.assets.digest
totrue
by default and will help users avoid hardcoding paths that work in development but break in production.