Skip to content

Commit 2df75ff

Browse files
author
Marc Robichaud
committed
Retain spaces before color().
1 parent 0852e8c commit 2df75ff

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function transformColor(string, source) {
4545
if (!balancedMatches) {
4646
throw new Error("Missing closing parentheses in '" + string + "'", source)
4747
}
48+
var leadingSpacings = balancedMatches.pre.match(/^\s*/)[0]
4849

49-
return string.slice(0, index) + colorFn.convert("color(" + balancedMatches.body + ")") + transformColor(balancedMatches.post)
50+
return string.slice(0, index) + leadingSpacings + colorFn.convert("color(" + balancedMatches.body + ")") + transformColor(balancedMatches.post)
5051
}

test/fixtures/color.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ body {
77
border-bottom-color: hover-color(red);
88

99
border-right-color: hover-color(color(red tint(50%)));
10+
11+
border-color: color(#999 a(0.8)) color(#999 a(0.8));
1012
}

test/fixtures/color.expected.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ body {
77
border-bottom-color: hover-color(red);
88

99
border-right-color: hover-color(rgb(255, 128, 128));
10+
11+
border-color: rgba(153, 153, 153, 0.8) rgba(153, 153, 153, 0.8);
1012
}

0 commit comments

Comments
 (0)