File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -136,12 +136,28 @@ if (isDevelopment) {
136
136
137
137
processStyleValue = ( key : string , value : string | number ) => {
138
138
if ( key === 'content' ) {
139
+ let isProperlyQuoted = false
140
+ if ( typeof value === 'string' ) {
141
+ const first = value . charAt ( 0 )
142
+ if ( ( first === '"' || first === "'" ) && value . length > 1 ) {
143
+ const closingIndex = value . lastIndexOf ( first )
144
+ if ( closingIndex > 0 ) {
145
+ const remainder = value . slice ( closingIndex + 1 ) . trim ( )
146
+ if (
147
+ closingIndex === value . length - 1 ||
148
+ remainder === '' ||
149
+ remainder === '!important'
150
+ ) {
151
+ isProperlyQuoted = true
152
+ }
15
8151
3
+ }
154
+ }
155
+ }
139
156
if (
140
157
typeof value !== 'string' ||
141
158
( contentValues . indexOf ( value ) === - 1 &&
142
159
! contentValuePattern . test ( value ) &&
143
- ( value . charAt ( 0 ) !== value . charAt ( value . length - 1 ) ||
144
- ( value . charAt ( 0 ) !== '"' && value . charAt ( 0 ) !== "'" ) ) )
160
+ ! isProperlyQuoted )
145
161
) {
146
162
throw new Error (
147
163
`You seem to be using a value for 'content' without quotes, try replacing it with \`content: '"${ value } "'\``
You can’t perform that action at this time.
0 commit comments