postcss-nesting
Advanced tools
Comparing version 3.0.0 to 4.0.0
# Changes to PostCSS Nesting | ||
### 4.0.0 (May 20, 2017) | ||
- Transform only compliant nesting | ||
- Preserve more raws formatting | ||
### 3.0.0 (May 8, 2017) | ||
@@ -4,0 +9,0 @@ |
// clean the raws of the node | ||
module.exports = (node) => { | ||
node.raws = {}; | ||
node.raws = Object.assign( | ||
node.raws.between ? { between: node.raws.between } : {}, | ||
node.raws.semicolon ? { semicolon: true } : {}, | ||
node.raws.important ? { important: node.raws.important } : {} | ||
); | ||
return node; | ||
}; |
@@ -25,2 +25,8 @@ // tooling | ||
// swap semicolon raws | ||
const semicolon = node.raws.semicolon; | ||
node.raws.semicolon = node.parent.raws.semicolon; | ||
node.parent.raws.semicolon = semicolon; | ||
// move the node after the parent | ||
@@ -27,0 +33,0 @@ const parent = node.parent.after(node); |
@@ -42,3 +42,3 @@ // tooling | ||
module.exports.test = (node) => node.type === 'atrule' && node.name === 'nest' && node.parent && node.parent.type === 'rule' && comma(node.params).every( | ||
(childNode) => childNode.indexOf('&') !== -1 | ||
(selector) => selector.split('&').length === 2 && /&([^A-z]|$)/.test(selector) | ||
); |
@@ -28,3 +28,3 @@ // tooling | ||
module.exports.test = (node) => node.type === 'rule' && node.parent && node.parent.type === 'rule' && node.selectors.every( | ||
(childNode) => childNode.trim()[0] === '&' | ||
(selector) => selector.trim().lastIndexOf('&') === 0 && /^&([^A-z]|$)/.test(selector) | ||
); |
{ | ||
"name": "postcss-nesting", | ||
"version": "3.0.0", | ||
"version": "4.0.0", | ||
"description": "Nest style and media rules inside each another, following the CSS Nesting Module Level 3 specification", | ||
@@ -5,0 +5,0 @@ "author": "Jonathan Neal <jonathantneal@hotmail.com>", |
@@ -60,3 +60,3 @@ # PostCSS Nesting [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss] | ||
postcss([ | ||
require('postcss-nesting')({ /* options */ }) | ||
require('postcss-nesting')({ /* options */ }) | ||
]).process(YOUR_CSS, /* options */); | ||
@@ -79,9 +79,9 @@ ``` | ||
gulp.task('css', function () { | ||
return gulp.src('./src/*.css').pipe( | ||
postcss([ | ||
require('postcss-nesting')({ /* options */ }) | ||
]) | ||
).pipe( | ||
gulp.dest('.') | ||
); | ||
return gulp.src('./src/*.css').pipe( | ||
postcss([ | ||
require('postcss-nesting')({ /* options */ }) | ||
]) | ||
).pipe( | ||
gulp.dest('.') | ||
); | ||
}); | ||
@@ -104,12 +104,12 @@ ``` | ||
grunt.initConfig({ | ||
postcss: { | ||
options: { | ||
use: [ | ||
require('postcss-nesting')({ /* options */ }) | ||
] | ||
}, | ||
dist: { | ||
src: '*.css' | ||
} | ||
} | ||
postcss: { | ||
options: { | ||
use: [ | ||
require('postcss-nesting')({ /* options */ }) | ||
] | ||
}, | ||
dist: { | ||
src: '*.css' | ||
} | ||
} | ||
}); | ||
@@ -116,0 +116,0 @@ ``` |
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
19608
173
0