Skip to content

Commit cae1e27

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/master' into gh-pages
2 parents d553a08 + c6197e1 commit cae1e27

File tree

12 files changed

+685
-675
lines changed

12 files changed

+685
-675
lines changed

CHANGELOG.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11

2+
# v0.5.1 - 2015-10-24
3+
4+
- Fix postcss/postcss#611 where we were trying to remove the root node on clean up
5+
- Improved test setup
6+
27
# v0.5.0 - 2015-9-12
38

49
- Upgrade to PostCSS v5. Fix #20
@@ -40,7 +45,7 @@
4045

4146
# v0.3.3 - 2015-5-11
4247

43-
- Add support for last piece of combinator chain in selector resolution matching.
48+
- Add support for last piece of combinator chain in selector resolution matching.
4449
- `.foo + .bar` can match variables declared in `.bar`
4550

4651
# v0.3.1 - 2015-5-5
@@ -65,4 +70,4 @@
6570

6671
# v0.1.0 - 2015-4-29
6772

68-
- First release
73+
- First release

README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ CSS variables or CSS Custom Properties limited subset polyfill/shim.
88

99
We strive for the most complete transformation but we/no plugin can achieve true complete parity according to the [specification](http://dev.w3.org/csswg/css-variables/) because of the DOM cascade unknowns.
1010

11-
## Latest Version: v0.5.0
1211
### [Changelog](https://github.com/MadLittleMods/postcss-css-variables/blob/master/CHANGELOG.md)
1312

1413
### Install
@@ -281,7 +280,7 @@ A custom property can be declared multiple times.
281280
### `preserve` (default: `false`)
282281

283282
Allows you to preserve custom properties & var() usage in output.
284-
Allowed values:
283+
Allowed values:
285284
- `false`: Removes `--var` declarations and replaces `var()` with their resolved/computed values.
286285
- `true`: Keeps `var()` declarations in the output and has the computed value as a fallback declaration. Also keeps computed `--var` declarations
287286
- `'computed'`: Keeps computed `--var` declarations in the output. Handy to make them available to your JavaScript.
@@ -292,7 +291,7 @@ Define an object map of variables in JavaScript that will be declared at the `:r
292291

293292
Can be a simple key-value pair or an object with a `value` property and an optional `isImportant` bool property
294293

295-
The object keys are automatically prefixed with `--` (according to CSS custom property syntax) if you do not provide it.
294+
The object keys are automatically prefixed with `--` (according to CSS custom property syntax) if you do not provide it.
296295

297296

298297
```
@@ -337,4 +336,4 @@ Run once:
337336

338337
Run whenever you want to test:
339338

340-
`npm run test`
339+
`npm run test`

index.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,23 @@ function eachCssVariableDeclaration(css, cb) {
3434

3535

3636

37-
function cleanUpNode(currentNodeToRemove) {
38-
// If we removed all of the declarations in the rule(making it empty), then just remove it
39-
var currentNodeToPossiblyCleanUp = currentNodeToRemove;
40-
while(currentNodeToPossiblyCleanUp && currentNodeToPossiblyCleanUp.nodes.length <= 0) {
41-
var nodeToRemove = currentNodeToPossiblyCleanUp;
42-
// Get a reference to it before we remove and lose reference to the child after removing it
43-
currentNodeToPossiblyCleanUp = currentNodeToPossiblyCleanUp.parent;
44-
45-
nodeToRemove.remove();
37+
function cleanUpNode(node) {
38+
// If we removed all of the declarations in the rule(making it empty),
39+
// then just remove it
40+
var nodeToPossiblyCleanUp = node;
41+
while(nodeToPossiblyCleanUp && nodeToPossiblyCleanUp.nodes.length <= 0) {
42+
var nodeToRemove = nodeToPossiblyCleanUp.type !== 'root' ? nodeToPossiblyCleanUp : null;
43+
44+
if(nodeToRemove) {
45+
// Get a reference to it before we remove
46+
// and lose reference to the child after removing it
47+
nodeToPossiblyCleanUp = nodeToRemove.parent;
48+
49+
nodeToRemove.remove();
50+
}
51+
else {
52+
nodeToPossiblyCleanUp = null;
53+
}
4654
}
4755
}
4856

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "postcss-css-variables",
3-
"version": "0.5.0",
3+
"version": "0.5.1",
44
"description": "PostCSS plugin to transform CSS Custom Properties(CSS variables) syntax into a static representation",
55
"keywords": [
66
"postcss",
77
"css",
8-
"postcssplugin"
8+
"postcss-plugin"
99
],
1010
"author": "Eric Eastwood <contact@ericeastwood.com> (http://ericeastwood.com/)",
1111
"license": "MIT",

0 commit comments

Comments
 (0)