posthtml-minify-classnames
posthtml-minify-classnames copied to clipboard
Any way to retrieve the mapping between old classnames and new ones ?
Hello,
is there a way to retrieve the mapping between old css classnames and the new ones ?
Thanks
I looked into this-- you can refactor the process function to do this:
process(tree) {
const result = this.minifyElements(this.minifyStyles(tree));
tree.messages.push({
type: 'info',
map: this.classMap,
from: 'posthtml-minify-classnames'
});
return result;
}
Then, you can read the message in the result:
const result = await posthtml(posthtmlPlugins).process(html);
const index = result.messages.findIndex(message => message.from === 'posthtml-minify-classnames');
console.log(result.messages[index]);