postcss-sorting
Advanced tools
Comparing version 1.6.0 to 1.6.1
@@ -5,2 +5,5 @@ # Change Log | ||
## 1.6.1 | ||
* Fixed a regression in 1.6.0. Sort order with item like `@include media` didn't found rules like `@include media(">=desk") {}`. | ||
## 1.6.0 | ||
@@ -7,0 +10,0 @@ * Add special comments to disable processing for some part in style sheet |
23
index.js
@@ -80,12 +80,25 @@ var postcss = require('postcss'); | ||
var atruleName = '@' + node.name; | ||
var sortNameExtended; | ||
var atruleParameter; | ||
// If atRule has a parameter like @mixin name or @include name, sort by this parameter | ||
var atruleParameter = (/^[\w-\(\)]+/).exec(node.params); | ||
// If atRule has a parameter like `@mixin name` or `@include name`, sort by this parameter | ||
if (node.params) { | ||
atruleParameter = node.params; | ||
sortNameExtended = atruleName + ' ' + atruleParameter; | ||
if (atruleParameter && atruleParameter.length) { | ||
var sortNameExtended = atruleName + ' ' + atruleParameter[0]; | ||
// check if there is a whole parameter in the config, e. g. `media("<=desk")` | ||
if (order[sortNameExtended]) { | ||
return sortNameExtended; | ||
} | ||
// check if there is a part of parameter in the config, e. g. `media` from `media("<=desk")` | ||
atruleParameter = (/^[\w-]+/).exec(atruleParameter); | ||
if (atruleParameter && atruleParameter.length) { | ||
sortNameExtended = atruleName + ' ' + atruleParameter[0]; | ||
if (order[sortNameExtended]) { | ||
return sortNameExtended; | ||
} | ||
} | ||
} | ||
@@ -92,0 +105,0 @@ |
{ | ||
"name": "postcss-sorting", | ||
"version": "1.6.0", | ||
"version": "1.6.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
56792
1544