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) {
136136
137137 processStyleValue = ( key : string , value : string | number ) => {
138138 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+ }
153+ }
154+ }
155+ }
139156 if (
140157 typeof value !== 'string' ||
141158 ( contentValues . indexOf ( value ) === - 1 &&
142159 ! contentValuePattern . test ( value ) &&
143- ( value . charAt ( 0 ) !== value . charAt ( value . length - 1 ) ||
144- ( value . charAt ( 0 ) !== '"' && value . charAt ( 0 ) !== "'" ) ) )
160+ ! isProperlyQuoted )
145161 ) {
146162 throw new Error (
147163 `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