Skip to content

Commit 9ee7fc2

Browse files
committed
verify that the correct placeholder is being returned
1 parent 7a6448f commit 9ee7fc2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/minify/index.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import { makePlaceholder, splitByPlaceholders } from '../css/placeholderUtils'
22

3+
let i = 0
4+
5+
const injectUniquePlaceholders = strArr =>
6+
strArr.reduce((str, val, index, arr) => {
7+
return str + val + (index < arr.length - 1 ? makePlaceholder(i++) : '')
8+
}, '')
9+
310
const makeMultilineCommentRegex = newlinePattern =>
411
new RegExp('\\/\\*[^!](.|' + newlinePattern + ')*?\\*\\/', 'g')
512
const lineCommentStart = /\/\//g
@@ -83,10 +90,10 @@ export const minifyRaw = minify('(?:\\\\r|\\\\n|\\r|\\n)')
8390
export const minifyCooked = minify('[\\r\\n]')
8491

8592
export const minifyRawValues = rawValues =>
86-
splitByPlaceholders(minifyRaw(rawValues.join(makePlaceholder(123))), false)
93+
splitByPlaceholders(minifyRaw(injectUniquePlaceholders(rawValues)), false)
8794

8895
export const minifyCookedValues = cookedValues =>
8996
splitByPlaceholders(
90-
minifyCooked(cookedValues.join(makePlaceholder(123))),
97+
minifyCooked(injectUniquePlaceholders(cookedValues)),
9198
false
9299
)

0 commit comments

Comments
 (0)