postcss-custom-properties
Advanced tools
Comparing version 8.0.0 to 8.0.1
# Changes to PostCSS Custom Properties | ||
### 8.0.1 (September 17, 2018) | ||
- Fixed: Workaround issue in `postcss-values-parser` incorrectly cloning nodes. | ||
### 8.0.0 (September 16, 2018) | ||
@@ -4,0 +8,0 @@ |
@@ -155,3 +155,3 @@ 'use strict'; | ||
// conditionally replace a known custom property | ||
child.replaceWith(...asClonedArray(customProperties[name])); | ||
child.replaceWith(...asClonedArray(customProperties[name], null)); | ||
const nextCustomProperties = Object.assign({}, customProperties); | ||
@@ -185,4 +185,21 @@ delete nextCustomProperties[name]; | ||
const asClonedArray = array => array.map(node => node.clone()); | ||
const asClonedArray = (array, parent) => array.map(node => asClonedNode(node, parent)); // return a cloned node | ||
const asClonedNode = (node, parent) => { | ||
const cloneNode = new node.constructor(node); | ||
for (const key in node) { | ||
if (key === 'parent') { | ||
cloneNode.parent = parent; | ||
} else if (Object(node[key]).constructor === Array) { | ||
cloneNode[key] = asClonedArray(node.nodes, cloneNode); | ||
} else if (Object(node[key]).constructor === Object) { | ||
cloneNode[key] = Object.assign({}, node[key]); | ||
} | ||
} | ||
return cloneNode; | ||
}; | ||
var transformProperties = ((root, customProperties, opts) => { | ||
@@ -556,1 +573,2 @@ // walk decls that can be transformed | ||
module.exports = index; | ||
//# sourceMappingURL=index.cjs.js.map |
{ | ||
"name": "postcss-custom-properties", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "Use Custom Properties Queries in CSS", | ||
@@ -17,3 +17,5 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", | ||
"index.cjs.js", | ||
"index.es.mjs" | ||
"index.cjs.js.map", | ||
"index.es.mjs", | ||
"index.es.mjs.map" | ||
], | ||
@@ -20,0 +22,0 @@ "scripts": { |
@@ -126,5 +126,5 @@ # PostCSS Custom Properties [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss] | ||
importFrom: [ | ||
'path/to/file.css', | ||
'and/then/this.js', | ||
'and/then/that.json', | ||
'path/to/file.css', // :root { --color: red; } | ||
'and/then/this.js', // module.exports = { customProperties: { '--color': 'red' } } | ||
'and/then/that.json', // { "custom-properties": { "--color": "red" } } | ||
{ | ||
@@ -142,2 +142,5 @@ customProperties: { '--color': 'red' } | ||
See example imports written in [CSS](test/import-properties.css), | ||
[JS](test/import-properties.js), and [JSON](test/import-properties.json). | ||
### exportTo | ||
@@ -177,2 +180,6 @@ | ||
See example exports written to [CSS](test/export-properties.css), | ||
[JS](test/export-properties.js), [MJS](test/export-properties.mjs), and | ||
[JSON](test/export-properties.json). | ||
[cli-img]: https://img.shields.io/travis/postcss/postcss-custom-properties.svg | ||
@@ -179,0 +186,0 @@ [cli-url]: https://travis-ci.org/postcss/postcss-custom-properties |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
107683
8
910
194
0