Skip to content

Commit 32f2064

Browse files
committed
Merge pull request #6 from darfink/skipmulticolor
Add 'skipMultiColor' option
2 parents 198b42e + fac6438 commit 32f2064

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ function gradientToFilter(gradient) {
144144

145145
return {
146146
string: filterGradient(startColor, endColor, type),
147+
isMultiColor: obj.colorStops.length > 2,
147148
isFallback: result.isFallback,
148149
message: result.message
149150
};
@@ -182,6 +183,8 @@ module.exports = postcss.plugin('postcss-filter-gradient', function (opts) {
182183
opts = opts || {};
183184
opts.angleFallback =
184185
opts.angleFallback === undefined ? true : opts.angleFallback;
186+
opts.skipMultiColor =
187+
opts.skipMultiColor === undefined ? false : opts.skipMultiColor;
185188

186189
return function (root, result) {
187190
root.walkRules(function (rule) {
@@ -198,6 +201,10 @@ module.exports = postcss.plugin('postcss-filter-gradient', function (opts) {
198201
if (gradient.value) {
199202
filter = gradientToFilter(gradient.value);
200203

204+
if (opts.skipMultiColor && filter.isMultiColor) {
205+
return;
206+
}
207+
201208
if (!opts.angleFallback && filter.isFallback) {
202209
return;
203210
}

0 commit comments

Comments
 (0)