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

Add assets.resolve_assets_in_css_urls configuration option to allow disabling AssetUrlProcessor #489

Merged

Conversation

rmacklin
Copy link
Contributor

@rmacklin rmacklin commented Dec 6, 2021

As reported in #478 / #486, the introduction of the AssetUrlProcessor in #476 broke some folks' CSS assets when they upgraded beyond sprockets-rails v3.2.2, but it was not released in a new major version.

To remedy this, let's make AssetUrlProcessor be opt-in for now with the plan to change it to opt-out in the next major version. In this PR, I'm proposing the addition of a new assets.rewrite_css_urls configuration option to control whether or not AssetUrlProcessor is registered. We can default it to false in sprockets-rails v3.x and change the default to true in v4.0.
Per #489 (comment), we'll roll forward with defaulting AssetUrlProcessor to enabled, but it can be disabled by setting a new assets.resolve_assets_in_css_urls configuration option to false.

@dhh
Copy link
Member

dhh commented Dec 8, 2021

I think this is a good option, but I don't see reverting what's now been released and out in the wild. If the 3.4.x series breaks things for you, you can set this option to avoid having the processor applied. But otherwise it's applied.

We're introducing a new configuration option `assets.rewrite_css_urls`
to allow users to opt out of the new `AssetUrlProcessor` (by configuring
that option to `false`).
@rmacklin rmacklin force-pushed the add-config-to-make-AssetUrlProcessor-opt-in branch from f3c88fb to a94fd77 Compare December 9, 2021 05:22
@rmacklin rmacklin marked this pull request as ready for review December 9, 2021 05:23
@rmacklin
Copy link
Contributor Author

rmacklin commented Dec 9, 2021

Ok, I dropped that change, added tests, and took the PR out of draft state.

@dhh
Copy link
Member

dhh commented Dec 9, 2021

This is looking good. We should document the option as well.

Also, I think going with resolve_assets_in_css_urls might be a more descriptive name for the configuration.

@rmacklin rmacklin changed the title Add assets.rewrite_css_urls configuration option to make AssetUrlProcessor opt-in Add assets.resolve_assets_in_css_urls configuration option to make AssetUrlProcessor opt-in Dec 10, 2021
@rmacklin rmacklin changed the title Add assets.resolve_assets_in_css_urls configuration option to make AssetUrlProcessor opt-in Add assets.resolve_assets_in_css_urls configuration option to allow AssetUrlProcessor to be disabled Dec 10, 2021
@rmacklin rmacklin changed the title Add assets.resolve_assets_in_css_urls configuration option to allow AssetUrlProcessor to be disabled Add assets.resolve_assets_in_css_urls configuration option to allow disabling AssetUrlProcessor Dec 10, 2021
@rmacklin
Copy link
Contributor Author

Ok, renamed the option to resolve_assets_in_css_urls and documented it in the README.

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

2 participants