Socket
Socket
Sign inDemoInstall

postcss-minify-selectors

Package Overview
Dependencies
7
Maintainers
8
Versions
63
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.2.0 to 5.2.1

5

package.json
{
"name": "postcss-minify-selectors",
"version": "5.2.0",
"version": "5.2.1",
"description": "Minify selectors with PostCSS.",

@@ -42,4 +42,3 @@ "main": "src/index.js",

"postcss": "^8.2.15"
},
"readme": "# [postcss][postcss]-minify-selectors\n\n> Minify selectors with PostCSS.\n\n## Install\n\nWith [npm](https://www.npmjs.com/package/postcss-minify-selectors) do:\n\n```\nnpm install postcss-minify-selectors --save\n```\n\n## Example\n\n### Input\n\n```css\nh1 + p, h2, h3, h2{color:blue}\n```\n\n### Output\n\n```css\nh1+p,h2,h3{color:blue}\n```\n\nFor more examples see the [tests](test.js).\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"
}
}

19

src/index.js

@@ -134,13 +134,14 @@ 'use strict';

const uniques = new Set();
selector.walk((child) => {
if (child.type === 'selector') {
const childStr = String(child);
if (child.type === 'selector' && child.parent) {
const uniques = new Set();
child.parent.each((sibling) => {
const siblingStr = String(sibling);
if (!uniques.has(childStr)) {
uniques.add(childStr);
} else {
child.remove();
}
if (!uniques.has(siblingStr)) {
uniques.add(siblingStr);
} else {
sibling.remove();
}
});
}

@@ -147,0 +148,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc