Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
generate({asset}) {
return {
code: render(nullthrows(asset.ast).program),
};
},
});
export default function removeUnusedCss(tree, options, uncssOptions) {
let promises = [];
const html = render(tree);
tree.walk(node => {
if (isStyleNode(node)) {
promises.push(processStyleNode(html, node, uncssOptions));
}
return node;
});
return Promise.all(promises).then(() => tree);
}
tree.match({tag: 'svg'}, node => {
let svgStr = posthtmlRender(node);
let promise = svgo.optimize(svgStr).then(result => {
node.tag = false;
node.attrs = {};
node.content = result.data;
});
promises.push(promise);
return node;
});
generate({asset}) {
return {
code: render(nullthrows(asset.ast).program),
};
},
});