Socket
Socket
Sign inDemoInstall

postcss-discard-empty

Package Overview
Dependencies
3
Maintainers
7
Versions
42
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 4.0.0-nightly.2020.1.9

56

dist/index.js

@@ -1,36 +0,42 @@

'use strict';
"use strict";
exports.__esModule = true;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _postcss = require('postcss');
var _postcss = _interopRequireDefault(require("postcss"));
function discardAndReport(css, result) {
function discardEmpty(node) {
var type = node.type;
var sub = node.nodes;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const plugin = 'postcss-discard-empty';
if (sub) {
node.each(discardEmpty);
}
function discardAndReport(css, result) {
function discardEmpty(node) {
const {
type,
nodes: sub,
params
} = node;
if (type === 'decl' && !node.value || type === 'rule' && !node.selector || sub && !sub.length || type === 'atrule' && (!sub && !node.params || !node.params && !sub.length)) {
node.remove();
if (sub) {
node.each(discardEmpty);
}
result.messages.push({
type: 'removal',
plugin: 'postcss-discard-empty',
node: node
});
}
if (type === 'decl' && !node.value || type === 'rule' && !node.selector || sub && !sub.length || type === 'atrule' && (!sub && !params || !params && !sub.length)) {
node.remove();
result.messages.push({
type: 'removal',
plugin,
node
});
}
}
css.each(discardEmpty);
css.each(discardEmpty);
}
exports.default = (0, _postcss.plugin)('postcss-discard-empty', function () {
return function (css, result) {
return discardAndReport(css, result);
};
});
module.exports = exports['default'];
var _default = _postcss.default.plugin(plugin, () => discardAndReport);
exports.default = _default;
module.exports = exports.default;
{
"name": "postcss-discard-empty",
"version": "2.1.0",
"version": "4.0.0-nightly.2020.1.9",
"description": "Discard empty rules and values with PostCSS.",

@@ -11,5 +11,5 @@ "main": "dist/index.js",

"scripts": {
"pretest": "eslint src",
"prepublish": "del-cli dist && babel src --out-dir dist --ignore /__tests__/",
"test": "ava src/__tests__"
"prebuild": "",
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"",
"prepublish": ""
},

@@ -27,17 +27,5 @@ "keywords": [

"dependencies": {
"postcss": "^5.0.14"
"postcss": "^7.0.16"
},
"devDependencies": {
"ava": "^0.14.0",
"babel-cli": "^6.4.5",
"babel-core": "^6.4.5",
"babel-plugin-add-module-exports": "^0.1.2",
"babel-preset-es2015": "^6.3.13",
"babel-preset-es2015-loose": "^7.0.0",
"babel-preset-stage-0": "^6.3.13",
"del-cli": "^0.2.0",
"eslint": "^2.0.0",
"eslint-config-cssnano": "^2.0.0"
},
"homepage": "https://github.com/ben-eb/postcss-discard-empty",
"homepage": "https://github.com/cssnano/cssnano",
"author": {

@@ -48,9 +36,9 @@ "name": "Ben Briggs",

},
"repository": "ben-eb/postcss-discard-empty",
"eslintConfig": {
"extends": "cssnano"
"repository": "cssnano/cssnano",
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
},
"ava": {
"require": "babel-core/register"
"engines": {
"node": ">=10.13.0"
}
}
}

@@ -1,2 +0,2 @@

# [postcss][postcss]-discard-empty [![Build Status](https://travis-ci.org/ben-eb/postcss-discard-empty.svg?branch=master)][ci] [![NPM version](https://badge.fury.io/js/postcss-discard-empty.svg)][npm] [![Dependency Status](https://gemnasium.com/ben-eb/postcss-discard-empty.svg)][deps]
# [postcss][postcss]-discard-empty

@@ -15,3 +15,3 @@ > Discard empty rules and values with PostCSS.

For more examples see the [tests](test.js).
For more examples see the [tests](src/__tests__/index.js).

@@ -39,7 +39,8 @@ ### Input

## Contributing
Pull requests are welcome. If you add functionality, then please add unit tests
to cover it.
## Contributors
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
## License

@@ -49,5 +50,3 @@

[ci]: https://travis-ci.org/ben-eb/postcss-discard-empty
[deps]: https://gemnasium.com/ben-eb/postcss-discard-empty
[npm]: http://badge.fury.io/js/postcss-discard-empty
[postcss]: https://github.com/postcss/postcss
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