Skip to content

Commit 657d2b4

Browse files
committed
Merge branch 'tec27-comma_defs'
2 parents b1594eb + d9970d1 commit 657d2b4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import postcss from 'postcss'
22
import replaceSymbols, {replaceAll} from 'icss-replace-symbols'
33

44
const matchImports = /^(.+?|\([\s\S]+?\))\s+from\s+("[^"]*"|'[^']*'|[\w-]+)$/
5-
const matchValueDefinition = /(?:,\s+|^)([\w-]+):?\s+("[^"]*"|'[^']*'|\w+\([^\)]+\)|[^,]+)\s?/g
5+
const matchValueDefinition = /(?:\s+|^)([\w-]+):?\s+(.+?)\s*$/g
66
const matchImport = /^([\w-]+)(?:\s+as\s+([\w-]+))?/
77
let options = {}
88
let importIndex = 0

test/index.js

+8
Original file line numberDiff line numberDiff line change
@@ -140,4 +140,12 @@ describe('constants', () => {
140140
.foo { color: i__const_red_11; }
141141
.bar { color: i__const_blue_10 }`)
142142
})
143+
144+
it('should allow definitions with commas in them', () => {
145+
test(
146+
'@value coolShadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14) ;\n' +
147+
'.foo { box-shadow: coolShadow; }',
148+
':export {\n coolShadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14);\n}\n' +
149+
'.foo { box-shadow: 0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14); }')
150+
})
143151
})

0 commit comments

Comments
 (0)