postcss-discard-empty
Advanced tools
Comparing version 2.1.0 to 4.0.0-nightly.2020.1.9
@@ -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 |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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 website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
31
0
3705
4
50
+ Addedpicocolors@0.2.1(transitive)
+ Addedpostcss@7.0.39(transitive)
+ Addedsource-map@0.6.1(transitive)
- Removedansi-regex@2.1.1(transitive)
- Removedansi-styles@2.2.1(transitive)
- Removedchalk@1.1.3(transitive)
- Removedescape-string-regexp@1.0.5(transitive)
- Removedhas-ansi@2.0.0(transitive)
- Removedhas-flag@1.0.0(transitive)
- Removedjs-base64@2.6.4(transitive)
- Removedpostcss@5.2.18(transitive)
- Removedsource-map@0.5.7(transitive)
- Removedstrip-ansi@3.0.1(transitive)
- Removedsupports-color@2.0.03.2.3(transitive)
Updatedpostcss@^7.0.16