Socket
Socket
Sign inDemoInstall

postcss-minify-params

Package Overview
Dependencies
Maintainers
2
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-minify-params - npm Package Compare versions

Comparing version 1.0.5 to 1.1.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

# 1.1.0
* Adds support for removing the unnecessary `all and` from media queries.
# 1.0.1

@@ -2,0 +6,0 @@

@@ -27,2 +27,7 @@ var postcss = require('postcss');

function removeNode(node) {
node.value = '';
node.type = 'word';
}
module.exports = postcss.plugin('postcss-minify-params', function () {

@@ -37,3 +42,3 @@ return function (css) {

params.walk(function (node) {
params.walk(function (node, index) {
if (node.type === 'div' || node.type === 'function') {

@@ -43,2 +48,16 @@ node.before = node.after = '';

node.value = ' ';
} else if (node.type === 'word') {
if (node.value === 'all' && rule.name === 'media') {
var nextSpace = params.nodes[index + 1];
var nextWord = params.nodes[index + 2];
var secondSpace = params.nodes[index + 3];
if (nextWord && nextWord.value === 'and') {
removeNode(nextWord);
removeNode(nextSpace);
if (secondSpace) {
removeNode(secondSpace);
}
}
removeNode(node);
}
}

@@ -50,4 +69,8 @@ }, true);

}).join();
if (!rule.params.length) {
rule.raws.afterName = '';
}
});
};
});

8

package.json
{
"name": "postcss-minify-params",
"version": "1.0.5",
"version": "1.1.0",
"description": "Minify at-rule params with PostCSS",

@@ -19,7 +19,7 @@ "keywords": [

"license": "MIT",
"repository": "TrySound/postcss-minify-params",
"repository": "ben-eb/postcss-minify-params",
"bugs": {
"url": "https://github.com/TrySound/postcss-minify-params/issues"
"url": "https://github.com/ben-eb/postcss-minify-params/issues"
},
"homepage": "https://github.com/TrySound/postcss-minify-params",
"homepage": "https://github.com/ben-eb/postcss-minify-params",
"dependencies": {

@@ -26,0 +26,0 @@ "alphanum-sort": "^1.0.1",

@@ -32,3 +32,3 @@ # postcss-minify-params [![Build Status][ci-img]][ci]

[PostCSS]: https://github.com/postcss/postcss
[ci-img]: https://travis-ci.org/TrySound/postcss-minify-params.svg
[ci]: https://travis-ci.org/TrySound/postcss-minify-params
[ci-img]: https://travis-ci.org/ben-eb/postcss-minify-params.svg
[ci]: https://travis-ci.org/ben-eb/postcss-minify-params
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