postcss-css-variables
Advanced tools
Comparing version
# v0.5.1 - 2015-10-24 | ||
- Fix postcss/postcss#611 where we were trying to remove the root node on clean up | ||
- Improved test setup | ||
# v0.5.0 - 2015-9-12 | ||
@@ -43,3 +48,3 @@ | ||
- Add support for last piece of combinator chain in selector resolution matching. | ||
- Add support for last piece of combinator chain in selector resolution matching. | ||
- `.foo + .bar` can match variables declared in `.bar` | ||
@@ -69,2 +74,2 @@ | ||
- First release | ||
- First release |
24
index.js
@@ -37,11 +37,19 @@ // PostCSS CSS Variables (postcss-css-variables) | ||
function cleanUpNode(currentNodeToRemove) { | ||
// If we removed all of the declarations in the rule(making it empty), then just remove it | ||
var currentNodeToPossiblyCleanUp = currentNodeToRemove; | ||
while(currentNodeToPossiblyCleanUp && currentNodeToPossiblyCleanUp.nodes.length <= 0) { | ||
var nodeToRemove = currentNodeToPossiblyCleanUp; | ||
// Get a reference to it before we remove and lose reference to the child after removing it | ||
currentNodeToPossiblyCleanUp = currentNodeToPossiblyCleanUp.parent; | ||
function cleanUpNode(node) { | ||
// If we removed all of the declarations in the rule(making it empty), | ||
// then just remove it | ||
var nodeToPossiblyCleanUp = node; | ||
while(nodeToPossiblyCleanUp && nodeToPossiblyCleanUp.nodes.length <= 0) { | ||
var nodeToRemove = nodeToPossiblyCleanUp.type !== 'root' ? nodeToPossiblyCleanUp : null; | ||
nodeToRemove.remove(); | ||
if(nodeToRemove) { | ||
// Get a reference to it before we remove | ||
// and lose reference to the child after removing it | ||
nodeToPossiblyCleanUp = nodeToRemove.parent; | ||
nodeToRemove.remove(); | ||
} | ||
else { | ||
nodeToPossiblyCleanUp = null; | ||
} | ||
} | ||
@@ -48,0 +56,0 @@ } |
{ | ||
"name": "postcss-css-variables", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation", | ||
@@ -8,3 +8,3 @@ "keywords": [ | ||
"css", | ||
"postcssplugin" | ||
"postcss-plugin" | ||
], | ||
@@ -11,0 +11,0 @@ "author": "Eric Eastwood <contact@ericeastwood.com> (http://ericeastwood.com/)", |
@@ -11,3 +11,2 @@ [](http://badge.fury.io/js/postcss-css-variables) [](https://travis-ci.org/MadLittleMods/postcss-css-variables) | ||
## Latest Version: v0.5.0 | ||
### [Changelog](https://github.com/MadLittleMods/postcss-css-variables/blob/master/CHANGELOG.md) | ||
@@ -285,3 +284,3 @@ | ||
Allows you to preserve custom properties & var() usage in output. | ||
Allowed values: | ||
Allowed values: | ||
- `false`: Removes `--var` declarations and replaces `var()` with their resolved/computed values. | ||
@@ -297,3 +296,3 @@ - `true`: Keeps `var()` declarations in the output and has the computed value as a fallback declaration. Also keeps computed `--var` declarations | ||
The object keys are automatically prefixed with `--` (according to CSS custom property syntax) if you do not provide it. | ||
The object keys are automatically prefixed with `--` (according to CSS custom property syntax) if you do not provide it. | ||
@@ -343,2 +342,2 @@ | ||
`npm run test` | ||
`npm run test` |
47840
0.34%785
0.9%