postcss-sorting
Advanced tools
Comparing version 1.3.0 to 1.3.1
@@ -5,2 +5,5 @@ # Change Log | ||
## 1.3.1 | ||
* Fix adding additional empty line if both `empty-lines-between-children-rules` and `empty-lines-between-media-rules` are not 0. #19 | ||
## 1.3.0 | ||
@@ -7,0 +10,0 @@ * Added `empty-lines-between-media-rules` option which set a number of empty lines between nested media rules. #16 |
14
index.js
@@ -184,16 +184,12 @@ var postcss = require('postcss'); | ||
function getApplicableNode(node) { | ||
function getApplicableNode(lookFor, node) { | ||
// find if there any rules before, and skip the comments | ||
var prevNode = node.prev(); | ||
if (prevNode.type === 'rule') { | ||
if (prevNode.type === lookFor) { | ||
return node; | ||
} | ||
if (prevNode.type === 'atrule') { | ||
return node; | ||
} | ||
if (prevNode.type === 'comment') { | ||
return getApplicableNode(prevNode); | ||
return getApplicableNode(lookFor, prevNode); | ||
} | ||
@@ -290,3 +286,3 @@ | ||
// between rules can be comments, so empty lines should be added to first comment between rules, rather than to rule | ||
applicableNode = getApplicableNode(node); | ||
applicableNode = getApplicableNode('rule', node); | ||
@@ -301,3 +297,3 @@ if (applicableNode) { | ||
// between rules can be comments, so empty lines should be added to first comment between rules, rather than to rule | ||
applicableNode = getApplicableNode(node); | ||
applicableNode = getApplicableNode('atrule', node); | ||
@@ -304,0 +300,0 @@ if (applicableNode) { |
{ | ||
"name": "postcss-sorting", | ||
"version": "1.3.0", | ||
"version": "1.3.1", | ||
"description": "PostCSS plugin to sort rules content with specified order.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49549
1466