Skip to content

Commit 0f19b62

Browse files
committed
improve ValueParser, handle escaped characters
Before this, `--width-1\/2` would be handled as: ```json [ { kind: 'word', value: '--width-\\' } { kind: 'separator', value: '/' } { kind: 'word', value: '2' } ] ``` But now it will be handled as: ```json [ { kind: 'word', value: '--width-\\/2' } ] ```
1 parent 896a48b commit 0f19b62

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

packages/tailwindcss/src/value-parser.ts

+8
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,14 @@ export function parse(input: string) {
149149
let currentChar = input.charCodeAt(i)
150150

151151
switch (currentChar) {
152+
// Current character is a `\` therefore the next character is escaped,
153+
// consume it together with the next character and continue.
154+
case BACKSLASH: {
155+
buffer += input[i] + input[i + 1]
156+
i++
157+
break
158+
}
159+
152160
// Space and commas are bundled into separators
153161
//
154162
// E.g.:

0 commit comments

Comments
 (0)