Skip to content

Commit b212b52

Browse files
committed
fix: replace escaped quotes within class names during SSR
1 parent 7795440 commit b212b52

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

.changeset/angry-humans-relax.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'twind': patch
3+
---
4+
5+
fix: replace escaped quotes within class names during SSR

packages/twind/src/ssr.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,11 @@ export function consume(markup: string, tw: (className: string) => string = tw$)
229229
// but this works for now
230230
const token =
231231
quote == `"`
232-
? value.replace(/(\[)'|'(])/g, `$1'$2`)
232+
? // `'` -> ' ' '
233+
value.replace(/(=|\[)(?:'|'|')|(?:'|'|')(])/g, `$1'$2`)
233234
: quote == `'`
234-
? value.replace(/(\[)"|"(])/g, `$1"$2`)
235+
? // `"` -> " " "
236+
value.replace(/(=|\[)(?:"|"|")|(?:"|"|")(])/g, `$1"$2`)
235237
: value
236238

237239
const className = tw(token)

0 commit comments

Comments
 (0)