postcss-unique-selectors
Advanced tools
Comparing version
@@ -8,4 +8,2 @@ "use strict"; | ||
var _alphanumSort = _interopRequireDefault(require("alphanum-sort")); | ||
var _postcssSelectorParser = _interopRequireDefault(require("postcss-selector-parser")); | ||
@@ -20,5 +18,5 @@ | ||
function unique(rule) { | ||
rule.selector = (0, _alphanumSort.default)([...new Set(rule.selectors)], { | ||
insensitive: true | ||
}).join(); | ||
const selector = [...new Set(rule.selectors)]; | ||
selector.sort(); | ||
rule.selector = selector.join(); | ||
} | ||
@@ -25,0 +23,0 @@ |
{ | ||
"name": "postcss-unique-selectors", | ||
"version": "5.0.2", | ||
"version": "5.0.3", | ||
"description": "Ensure CSS selectors are unique.", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"", | ||
"prepare": "yarn build" | ||
}, | ||
"files": [ | ||
@@ -29,3 +24,2 @@ "LICENSE-MIT", | ||
"dependencies": { | ||
"alphanum-sort": "^1.0.2", | ||
"postcss-selector-parser": "^6.0.5" | ||
@@ -44,3 +38,8 @@ }, | ||
"postcss": "^8.2.15" | ||
} | ||
} | ||
}, | ||
"scripts": { | ||
"prebuild": "rimraf dist", | ||
"build": "babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"" | ||
}, | ||
"readme": "# [postcss][postcss]-unique-selectors\n\n> Ensure CSS selectors are unique.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-unique-selectors) do:\n\n```\nnpm install postcss-unique-selectors --save\n```\n\n## Example\n\nSelectors are sorted naturally, and deduplicated:\n\n### Input\n\n```css\nh1,h3,h2,h1 {\n color: red\n}\n```\n\n### Output\n\n```css\nh1,h2,h3 {\n color: red\n}\n```\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[postcss]: https://github.com/postcss/postcss\n" | ||
} |
4753
14.25%2
-33.33%41
-2.38%- Removed
- Removed