Skip to content

Commit 6a2c775

Browse files
Added option to skip warnings
1 parent bc76bf9 commit 6a2c775

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

index.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,8 @@ module.exports = postcss.plugin('postcss-filter-gradient', function (opts) {
253253
opts.angleFallback === undefined ? true : opts.angleFallback;
254254
opts.skipMultiColor =
255255
opts.skipMultiColor === undefined ? false : opts.skipMultiColor;
256+
opts.skipWarnings =
257+
opts.skipWarnings === undefined ? true : opts.skipWarnings;
256258

257259
return function (root, result) {
258260
root.walkRules(function (rule) {
@@ -261,15 +263,18 @@ module.exports = postcss.plugin('postcss-filter-gradient', function (opts) {
261263

262264
gradient = getGradientFromRule(rule);
263265

264-
// if linear-gradient and `filter` both exist, warn users
265-
if (gradient.value && hasFilter(rule)) {
266-
rule.warn(
267-
result,
268-
'The `filter` declaration already exists, we have skipped this rule.'
269-
);
270-
return;
266+
if (opts.skipWarnings === false) {
267+
// if linear-gradient and `filter` both exist, warn users
268+
if (gradient.value && hasFilter(rule)) {
269+
rule.warn(
270+
result,
271+
'The `filter` declaration already exists, we have skipped this rule.'
272+
);
273+
return;
274+
}
271275
}
272276

277+
273278
if (gradient.warnings) {
274279
gradient.decl.warn(result, gradient.warnings);
275280
}

0 commit comments

Comments
 (0)