-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
So that values with the same prefixes don't stomp over each other. This feels a bit hacky but works for now. Fixes #363
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,6 +69,7 @@ module.exports = (css, result) => { | |
|
||
matchRegex = new RegExp( | ||
Object.keys(values) | ||
.sort((a, b) => b.length - a.length) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pygy
|
||
.map((v) => `\\b${escape(v)}\\b`) | ||
.join("|"), | ||
"g" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ | |
.blue { | ||
color: colors.b; | ||
} | ||
|
||
.other { | ||
color: colors.base-other; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
@value a: red; | ||
@value b: blue; | ||
@value base: #FFF; | ||
@value base-other: #000; |
If it can help you feel better about the fix, that was my first idea as well. I think it is optimal as it guarantees that potential prefixes are replaced last, without resorting to string content comparisons that would be costlier.