Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Re-escape commas when updating classes #119

Merged
merged 1 commit into from Mar 19, 2021
Merged

Conversation

bradlc
Copy link
Contributor

@bradlc bradlc commented Mar 19, 2021

Fixes #45

When running classes through postcss-selector-parser (in updateAllClasses and updateLastClasses) the classes (which we have already escaped, see #91) are re-escaped, and the commas are converted back from \2c  to \,. This PR converts them back so that commas in classes containing variants are not affected by the minifier bug.

I'm not sure if setting raws.value is the best way to do this, so open to other suggestions! Another option I considered is to run escapeCommas on the result in these functions, but result is a full selector (e.g. .something .another div) so this felt less "correct" to me.

@adamwathan
Copy link
Member

I think this makes sense, I will dive into the raws.value thing and try and remember exactly how that works but if the tests are passing then it's at least as good as it was so worth merging! Thanks man.

@adamwathan adamwathan merged commit abc850e into main Mar 19, 2021
@adamwathan adamwathan deleted the fix-variant-commas branch March 19, 2021 18:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Arbitrary values with commas don't work in production builds in Next.js
2 participants