Skip to content

Commit

Permalink
Use PostCSS 6 API
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed May 8, 2017
1 parent 7efda11 commit ca7a4fa
Show file tree
Hide file tree
Showing 3 changed files with 218 additions and 213 deletions.
10 changes: 6 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function selectors(parent, node) {

function pickComment(comment, after) {
if ( comment && comment.type === 'comment' ) {
return comment.moveAfter(after);
return after.after(comment);
} else {
return after;
}
Expand All @@ -37,7 +37,9 @@ function atruleChilds(rule, atrule) {
});
if ( children.length ) {
var clone = rule.clone({ nodes: [] });
for ( var i = 0; i < children.length; i++ ) children[i].moveTo(clone);
for ( var i = 0; i < children.length; i++ ) {
clone.append(children[i]);
}
atrule.prepend(clone);
}
}
Expand All @@ -50,13 +52,13 @@ function processRule(rule, bubble) {
unwrapped = true;
child.selectors = selectors(rule, child);
after = pickComment(child.prev(), after);
after = child.moveAfter(after);
after.after(child);
} else if ( child.type === 'atrule' ) {
if ( bubble.indexOf(child.name) !== -1 ) {
unwrapped = true;
atruleChilds(rule, child);
after = pickComment(child.prev(), after);
after = child.moveAfter(after);
after.after(child);
}
}
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"license": "MIT",
"repository": "postcss/postcss-nested",
"dependencies": {
"postcss": "^5.2.17"
"postcss": "^6.0.1"
},
"devDependencies": {
"eslint": "^3.12.2",
"eslint-config-postcss": "^2.0.2",
"jest": "^19.0.2"
"jest": "^20.0.0"
},
"scripts": {
"test": "jest && eslint *.js"
Expand Down
Loading

0 comments on commit ca7a4fa

Please sign in to comment.