Opal-Estate-Pro/node_modules/csso/lib/compressor/clean/Space.js

17 lines
408 B
JavaScript
Raw Normal View History

2019-09-13 06:27:52 +02:00
function canCleanWhitespace(node) {
if (node.type !== 'Operator') {
return false;
}
return node.value !== '+' && node.value !== '-';
}
module.exports = function cleanWhitespace(node, item, list) {
var prev = item.prev && item.prev.data;
var next = item.next && item.next.data;
if (canCleanWhitespace(prev) || canCleanWhitespace(next)) {
list.remove(item);
}
};