postcss-css-variables
Advanced tools
Comparing version
# v0.4.0 - 2015-7-2 | ||
- Fix #15 | ||
- Remove slowness from cloning the `root` with `node.clone().removeAll()`. Now using `./lib/shallow-clone-node.js` to avoid cloning children which will get removed right after. | ||
- Thank you to @ddprrt for bringing up the slowness issue in this article, [PostCSS misconceptions](https://medium.com/@ddprrt/postcss-misconceptions-faf5dc5038df). | ||
# v0.3.9 - 2015-6-29 | ||
@@ -3,0 +11,0 @@ |
// PostCSS CSS Variables (postcss-css-variables) | ||
// v0.3.8 | ||
// v0.4.0 | ||
// | ||
@@ -12,2 +12,3 @@ // https://github.com/MadLittleMods/postcss-css-variables | ||
var shallowCloneNode = require('./lib/shallow-clone-node'); | ||
var resolveValue = require('./lib/resolve-value'); | ||
@@ -27,3 +28,3 @@ var resolveDecl = require('./lib/resolve-decl'); | ||
// Loop through all of the declarations and grab the variables and put them in the map | ||
css.eachDecl(function(decl, index) { | ||
css.eachDecl(function(decl) { | ||
// If declaration is a variable | ||
@@ -142,3 +143,3 @@ if(RE_VAR_PROP.test(decl.prop)) { | ||
// Create a detached clone | ||
var splitOutRule = decl.parent.clone().removeAll(); | ||
var splitOutRule = shallowCloneNode(decl.parent); | ||
splitOutRule.selector = selector; | ||
@@ -145,0 +146,0 @@ splitOutRule.parent = decl.parent.parent; |
@@ -0,1 +1,4 @@ | ||
var shallowCloneNode = require('./shallow-clone-node'); | ||
// Splice on a parent scope onto a node | ||
@@ -18,3 +21,3 @@ // And return a detached clone | ||
else { | ||
cloneList.push(current.clone().removeAll()); | ||
cloneList.push(shallowCloneNode(current)); | ||
} | ||
@@ -32,3 +35,3 @@ | ||
while(currentParent) { | ||
cloneParentList.push(currentParent.clone().removeAll()); | ||
cloneParentList.push(shallowCloneNode(currentParent)); | ||
@@ -35,0 +38,0 @@ currentParent = currentParent.parent; |
@@ -8,2 +8,3 @@ var resolveValue = require('./resolve-value'); | ||
var shallowCloneNode = require('./shallow-clone-node'); | ||
var findNodeAncestorWithSelector = require('./find-node-ancestor-with-selector'); | ||
@@ -47,3 +48,3 @@ var cloneSpliceParentOntoNodeWhen = require('./clone-splice-parent-onto-node-when'); | ||
// Create a detached clone | ||
var ruleClone = decl.parent.clone().removeAll(); | ||
var ruleClone = shallowCloneNode(decl.parent); | ||
ruleClone.parent = decl.parent.parent; | ||
@@ -96,3 +97,3 @@ | ||
eachMapItemDependencyOfDecl(valueResults.variablesUsed, map, decl, function(mimicDecl, mapItem) { | ||
var ruleClone = decl.parent.clone().removeAll(); | ||
var ruleClone = shallowCloneNode(decl.parent); | ||
var declClone = decl.clone(); | ||
@@ -108,3 +109,3 @@ // No mangle resolve | ||
// Create the clean atRule for which we place the declaration under | ||
var atRuleNode = mapItem.parent.parent.clone().removeAll(); | ||
var atRuleNode = shallowCloneNode(mapItem.parent.parent); | ||
@@ -120,3 +121,3 @@ // Add the rule to the atRule | ||
// Create a new clean clone of that at rule to nest under | ||
var newParentAtRuleNode = currentAtRuleNode.parent.clone().removeAll(); | ||
var newParentAtRuleNode = shallowCloneNode(currentAtRuleNode.parent); | ||
@@ -123,0 +124,0 @@ // Append the old parent |
{ | ||
"name": "postcss-css-variables", | ||
"version": "0.3.9", | ||
"version": "0.4.0", | ||
"description": "PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -11,3 +11,3 @@ [](http://badge.fury.io/js/postcss-css-variables) [](https://travis-ci.org/MadLittleMods/postcss-css-variables) | ||
## Latest Version: v0.3.9 | ||
## Latest Version: v0.4.0 | ||
### [Changelog](https://github.com/MadLittleMods/postcss-css-variables/blob/master/CHANGELOG.md) | ||
@@ -240,2 +240,3 @@ | ||
- Nested rules which can be fully deduced with [`postcss-nested`](https://github.com/postcss/postcss-nested). | ||
- Pseudo class/element support `:hover`, etc | ||
@@ -242,0 +243,0 @@ |
47628
3.44%18
5.88%778
5.85%340
0.29%