You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CSS: url(unquoted) is broken: Can be lowercased, normalized and broken across lines #2835
lang:css/scss/lessIssues affecting CSS, Less or SCSSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.scope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency
Expected behavior:
Some characters are lowercased inside the base64-encoded @font-faceurl() rendering them useless.
Anything inside url() should be left untouched.
Reacted by Anton Novik, Michael DeRazon, Hrusikesh Panda, ULIVZ, judbd, Aravind Nair, Xiaohan Li and Ding
Oh, this is a tough one. The parser doesn't treat the whole url(...) as one single thing, but parses everything inside the parens. So it thinks that 0ThisIsLowerCased is the number 0 with the "ThisIsLowerCased" unit. There might be a workaround we can use, but the real fix is to add url-unquoted support to postcss-values-parser.
changed the title [-]Characters inside base64-encoded @font-face url() should not be converted to lowercase[/-][+]CSS: `url(unquoted)` is broken: Can be lowercased, normalized and broken across lines[/+]on Sep 16, 2017
Yeah, I guess SCSS and Less have different rules for the url function. Difficult problem. I think I’m going to leave it up to you to come up with the best solution given what we have, that works for most people’s use cases :)
lang:css/scss/lessIssues affecting CSS, Less or SCSSlocked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.scope:dependencyIssues that cannot be solved inside Prettier itself, and must be fixed in a dependency
Activity
lydell commentedon Sep 15, 2017
Oh, this is a tough one. The parser doesn't treat the whole
url(...)as one single thing, but parses everything inside the parens. So it thinks that0ThisIsLowerCasedis the number 0 with the "ThisIsLowerCased" unit. There might be a workaround we can use, but the real fix is to add url-unquoted support to postcss-values-parser.To get you unblocked, add quotes:
Prettier 1.7.0
Playground link
Input:
Output:
sampi commentedon Sep 15, 2017
The quickest unblock was to place the affected files in
.prettierignore, but the'idea is better.Thanks!
[-]Characters inside base64-encoded @font-face url() should not be converted to lowercase[/-][+]CSS: `url(unquoted)` is broken: Can be lowercased, normalized and broken across lines[/+]alexander-akait commentedon Jan 25, 2018
@lydell we can't use
url-unquotedbecause we need parseurlfunc inside to allow usage variables for css, less, scss - exampleurl(var(--somevar))lydell commentedon Jan 25, 2018
As far as I know
url(var(--somevar))is equivalent tourl("var(--somevar)")due to legacy reasons (url()is the only function wherevar()cannot be used). https://youtu.be/UQRSaG1hQ20?t=8m14salexander-akait commentedon Jan 26, 2018
@lydell how about:
It is valid as unquoted url, but it is less variable, seems we should fix it in prettier
lydell commentedon Jan 26, 2018
Yeah, I guess SCSS and Less have different rules for the
urlfunction. Difficult problem. I think I’m going to leave it up to you to come up with the best solution given what we have, that works for most people’s use cases :)alexander-akait commentedon Jan 26, 2018
@lydell i try to find solution, maybe we can fix this for
data:(PR exists), looks it is have equals rules for all preprocessorsalexander-akait commentedon Feb 2, 2018
Only problem with:
robert-j-webb commentedon Feb 10, 2020
This appears to be fixed: playground
alexander-akait commentedon Feb 10, 2020
Partial fixed
CSS: Fix url() unquoted content manipulation (prettier#2835)
CSS: Fix url() unquoted content manipulation (prettier#2835)
CSS: Fix url() unquoted content manipulation (prettier#2835)
CSS: Fix url() unquoted content manipulation (prettier#2835)
CSS: Fix url() unquoted content manipulation (prettier#2835)
CSS: Fix url() unquoted content manipulation (#2835) (#7592)