Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-minify-selectors

Package Overview
Dependencies
Maintainers
2
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-minify-selectors - npm Package Compare versions

Comparing version 1.5.0 to 2.0.0

6

CHANGELOG.md

@@ -0,1 +1,7 @@

# 2.0.0
* Upgraded to PostCSS 5.
* At-rule parameter minification was extracted out of this module into
postcss-minify-params (thanks to @TrySound).
# 1.5.0

@@ -2,0 +8,0 @@

25

index.js
'use strict';
var uniqs = require('uniqs');
var postcss = require('postcss');
var comma = postcss.list.comma;
var normalize = require('normalize-selector');
var natural = require('javascript-natural-sort');

@@ -13,17 +10,2 @@ var unquote = require('./lib/unquote');

function uniq (params, map) {
var transform = uniqs(comma(params).map(function (selector) {
// Join selectors that are split over new lines
return selector.replace(/\\\n/g, '');
})).sort(natural);
return map ? transform : transform.join(',');
}
function optimiseAtRule (rule) {
if (!rule.params) {
return;
}
rule.params = normalize(uniq(rule.params));
}
function getParsed (selectors, callback) {

@@ -51,3 +33,3 @@ return parser(callback).process(selectors).result;

function optimise (rule) {
var selector = rule._selector && rule._selector.raw || rule.selector;
var selector = rule.raws.selector && rule.raws.selector.raw || rule.selector;
rule.selector = getParsed(selector, function (selectors) {

@@ -116,7 +98,6 @@ selectors.nodes.sort(function (a, b) {

return function (css) {
css.eachInside(function (node) {
if (node.type === 'rule') { return optimise(node); }
if (node.type === 'atrule') { return optimiseAtRule(node); }
css.walkRules(function (rule) {
return optimise(rule);
});
};
});
{
"name": "postcss-minify-selectors",
"version": "1.5.0",
"version": "2.0.0",
"description": "Minify selectors with PostCSS.",

@@ -23,4 +23,4 @@ "main": "index.js",

"postcss-font-magician": "^1.3.0",
"tap-spec": "^4.0.2",
"tape": "^4.1.0"
"tap-spec": "^4.1.0",
"tape": "^4.2.0"
},

@@ -39,7 +39,5 @@ "homepage": "https://github.com/ben-eb/postcss-minify-selectors",

"javascript-natural-sort": "^0.7.1",
"normalize-selector": "^0.2.0",
"postcss": "^4.1.16",
"postcss-selector-parser": "^1.1.2",
"uniqs": "^2.0.0"
"postcss": "^5.0.4",
"postcss-selector-parser": "^1.1.4"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc