postcss-minify-params
Advanced tools
Comparing version 1.0.5 to 1.1.0
@@ -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 = ''; | ||
} | ||
}); | ||
}; | ||
}); |
{ | ||
"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 |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
5407
62
0