Opal-Estate-Pro/node_modules/postcss-discard-empty/dist/index.js
2019-09-13 11:27:52 +07:00

36 lines
909 B
JavaScript
Executable File

'use strict';
exports.__esModule = true;
var _postcss = require('postcss');
function discardAndReport(css, result) {
function discardEmpty(node) {
var type = node.type;
var sub = node.nodes;
if (sub) {
node.each(discardEmpty);
}
if (type === 'decl' && !node.value || type === 'rule' && !node.selector || sub && !sub.length || type === 'atrule' && (!sub && !node.params || !node.params && !sub.length)) {
node.remove();
result.messages.push({
type: 'removal',
plugin: 'postcss-discard-empty',
node: node
});
}
}
css.each(discardEmpty);
}
exports.default = (0, _postcss.plugin)('postcss-discard-empty', function () {
return function (css, result) {
return discardAndReport(css, result);
};
});
module.exports = exports['default'];