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

Clarify CSS url conversions in README #234

Open
mrj opened this issue Feb 12, 2025 · 0 comments
Open

Clarify CSS url conversions in README #234

mrj opened this issue Feb 12, 2025 · 0 comments

Comments

@mrj
Copy link

mrj commented Feb 12, 2025

Propshaft's README currently has the following text to describe how URLs in CSS files are converted:

Propshaft will automatically convert asset references in CSS to use the digested file names. So background: url("/bg/pattern.svg") is converted to background: url("/assets/bg/pattern-2169cbef.svg") before the stylesheet is served.

This only works if "bg" is a subdirectory of an asset path like "images". If "bg" is it's own top-level asset directory, url("pattern.svg") (with or without a leading slash) must instead be written. Similarly, the principle of least surprise path url("images/pattern.svg") won't usually work for assets in "images". So, most-commonly, such CSS URLs won't contain slashes, making the "bg" example misleading.

Suggested text: The path given in a CSS URL must be the path of that asset relative to one of the registered asset directory paths. [examples...]

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

No branches or pull requests

1 participant