postcss-lab-function
Advanced tools
Comparing version 3.0.1 to 3.1.0
# Changes to PostCSS Lab Function | ||
### 3.1.0 (April 25, 2020) | ||
- Updated: `postcss-values-parser` to 3.2.0 (minor). | ||
### 3.0.1 (April 12, 2020) | ||
@@ -4,0 +8,0 @@ |
@@ -11,3 +11,3 @@ 'use strict'; | ||
const visitor = node => { | ||
const onCSSFunction = node => { | ||
/** @type {{ name: string, nodes: CSSNode[] }} */ | ||
@@ -155,14 +155,17 @@ const { | ||
const visitor$1 = decl => { | ||
const onCSSDeclaration = decl => { | ||
const { | ||
value | ||
value: originalValue | ||
} = decl; | ||
if (hasAnyColorFunction(value)) { | ||
const valueAST = postcssValuesParser.parse(value); | ||
valueAST.walkFuncs(visitor); | ||
const newValue = String(valueAST); | ||
if (options.preserve) decl.cloneBefore({ | ||
value: newValue | ||
});else decl.value = newValue; | ||
if (hasAnyColorFunction(originalValue)) { | ||
const valueAST = postcssValuesParser.parse(originalValue); | ||
valueAST.walkFuncs(onCSSFunction); | ||
const modifiedValue = String(valueAST); | ||
if (modifiedValue !== originalValue) { | ||
if (options.preserve) decl.cloneBefore({ | ||
value: modifiedValue | ||
});else decl.value = modifiedValue; | ||
} | ||
} | ||
@@ -180,3 +183,3 @@ }; | ||
const plugin = postcss.plugin('postcss-lab-function', | ||
const postcssPlugin = postcss.plugin('postcss-lab-function', | ||
/** @type {PostCSSPluginInitializer} */ | ||
@@ -186,3 +189,3 @@ opts => { | ||
return root => { | ||
root.walkDecls(visitor$1); | ||
root.walkDecls(onCSSDeclaration); | ||
}; | ||
@@ -196,2 +199,2 @@ }); | ||
module.exports = plugin; | ||
module.exports = postcssPlugin; |
@@ -7,3 +7,3 @@ import postcss from 'postcss'; | ||
const visitor = node => { | ||
const onCSSFunction = node => { | ||
/** @type {{ name: string, nodes: CSSNode[] }} */ | ||
@@ -151,14 +151,17 @@ const { | ||
const visitor$1 = decl => { | ||
const onCSSDeclaration = decl => { | ||
const { | ||
value | ||
value: originalValue | ||
} = decl; | ||
if (hasAnyColorFunction(value)) { | ||
const valueAST = parse(value); | ||
valueAST.walkFuncs(visitor); | ||
const newValue = String(valueAST); | ||
if (options.preserve) decl.cloneBefore({ | ||
value: newValue | ||
});else decl.value = newValue; | ||
if (hasAnyColorFunction(originalValue)) { | ||
const valueAST = parse(originalValue); | ||
valueAST.walkFuncs(onCSSFunction); | ||
const modifiedValue = String(valueAST); | ||
if (modifiedValue !== originalValue) { | ||
if (options.preserve) decl.cloneBefore({ | ||
value: modifiedValue | ||
});else decl.value = modifiedValue; | ||
} | ||
} | ||
@@ -176,3 +179,3 @@ }; | ||
const plugin = postcss.plugin('postcss-lab-function', | ||
const postcssPlugin = postcss.plugin('postcss-lab-function', | ||
/** @type {PostCSSPluginInitializer} */ | ||
@@ -182,3 +185,3 @@ opts => { | ||
return root => { | ||
root.walkDecls(visitor$1); | ||
root.walkDecls(onCSSDeclaration); | ||
}; | ||
@@ -192,2 +195,2 @@ }); | ||
export default plugin; | ||
export default postcssPlugin; |
{ | ||
"name": "postcss-lab-function", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Use lab() and lch() color functions in CSS", | ||
@@ -30,3 +30,3 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
"postcss": "^7.0.27", | ||
"postcss-values-parser": "^3.1.1" | ||
"postcss-values-parser": "^3.2.0" | ||
}, | ||
@@ -39,3 +39,3 @@ "devDependencies": { | ||
"postcss-tape": "^5.0.2", | ||
"rollup": "^2.6.0", | ||
"rollup": "^2.7.2", | ||
"rollup-plugin-babel": "^4.4.0" | ||
@@ -42,0 +42,0 @@ }, |
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
26682
276
Updatedpostcss-values-parser@^3.2.0