Skip to content
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

Merged
merged 1 commit into from May 19, 2014

Conversation

dkthehuman
Copy link

@dkthehuman dkthehuman commented May 17, 2014

With rails/sprockets-rails#149, assets will only be served if the request has a digest if config.assets.digest = true and config.assets.raise_runtime_errors = true.

This PR sets config.assets.digest to true by default and will help users avoid hardcoding paths that work in development but break in production.

@rafaelfranca
Copy link
Member

rafaelfranca commented May 17, 2014

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
Copy link
Author

@dkthehuman dkthehuman May 17, 2014

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.

@dkthehuman
Copy link
Author

dkthehuman commented May 17, 2014

Done!

@dkthehuman
Copy link
Author

dkthehuman commented May 17, 2014

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 /src='\/\/example\.com\/assets\/rails\.png'/ when actual is "var src='//example.com/assets/rails-495b94d9cdd18b3a6eba96326cd909de.png';\n")

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"
Copy link
Member

@rafaelfranca rafaelfranca May 19, 2014

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?

Copy link
Author

@dkthehuman dkthehuman May 19, 2014

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.

@rafaelfranca
Copy link
Member

rafaelfranca commented May 19, 2014

Could you add a CHANGELOG entry?

@dkthehuman
Copy link
Author

dkthehuman commented May 19, 2014

Sure. Do you mean another CHANGELOG entry in addition to the one already added to railties/CHANGELOG.md?

@rafaelfranca
Copy link
Member

rafaelfranca commented May 19, 2014

Oops, it is there already. thanks.

rafaelfranca added a commit that referenced this pull request May 19, 2014
Default config.assets.digests to true in development
@rafaelfranca rafaelfranca merged commit 09cc922 into rails:master May 19, 2014
@dkthehuman
Copy link
Author

dkthehuman commented May 19, 2014

Thanks @rafaelfranca and @matthewd for your help in getting this and rails/sprockets-rails#149 done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants