postcss-color-function
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -0,1 +1,8 @@ | ||
# 3.0.0 - 2017-02-01 | ||
- Changed: send postcss warning when color function cannot be parsed instead of throwing | ||
([#35](https://github.com/postcss/postcss-color-function/pull/35) - @drewbourne) | ||
- Changed: send a postcss message when color function contains a var() | ||
([#36](https://github.com/postcss/postcss-color-function/pull/36) - @drewbourne) | ||
# 2.0.1 - 2016-03-15 | ||
@@ -2,0 +9,0 @@ |
28
index.js
@@ -13,3 +13,3 @@ /** | ||
module.exports = postcss.plugin("postcss-color-function", function() { | ||
return function(style) { | ||
return function(style, result) { | ||
style.walkDecls(function transformDecl(decl) { | ||
@@ -20,5 +20,25 @@ if (!decl.value || decl.value.indexOf("color(") === -1) { | ||
decl.value = helpers.try(function transformColorValue() { | ||
return transformColor(decl.value) | ||
}, decl.source) | ||
if (decl.value.indexOf("var(") !== -1) { | ||
result.messages.push({ | ||
plugin: "postcss-color-function", | ||
type: "skipped-color-function-with-custom-property", | ||
word: decl.value, | ||
message: | ||
"Skipped color function with custom property `" + | ||
decl.value + | ||
"`" | ||
}) | ||
return | ||
} | ||
try { | ||
decl.value = helpers.try(function transformColorValue() { | ||
return transformColor(decl.value) | ||
}, decl.source) | ||
} catch (error) { | ||
decl.warn(result, error.message, { | ||
word: decl.value, | ||
index: decl.index, | ||
}) | ||
} | ||
}) | ||
@@ -25,0 +45,0 @@ } |
{ | ||
"name": "postcss-color-function", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "PostCSS plugin to transform W3C CSS color function to more compatible CSS.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7663
56