UNPKG

motion

Version:

motion - moving development forward

21 lines (17 loc) 520 B
'use strict'; var postcss = require('postcss'); function discardEmpty(node) { if (node.nodes) { node.each(discardEmpty); } if ( (node.type === 'decl' && !node.value) || (node.type === 'rule' && !node.selector || (node.nodes && !node.nodes.length)) || (node.type === 'atrule' && ((!node.nodes && !node.params) || (!node.params && !node.nodes.length))) ) { node.remove(); } } module.exports = postcss.plugin('postcss-discard-empty', function () { return function (css) { css.each(discardEmpty); }; });