0.3.0 • Published 4 years ago
posthtml-postcss-treeshaker v0.3.0
posthtml-postcss-treeshaker
A posthtml
plugin to treeshake class and id styling in style
tag on html page using postcss
This plugin is used for reducing your file size
Before:
<html>
<body>
<p class="used">HELLO</p>
<style>
.used {
color: red;
}
.unused {
color: green;
}
</style>
</body>
</html>
After:
<html>
<body>
<p class="used">HELLO</p>
<style>
.used {
color: red;
}
</style>
</body>
</html>
Install
npm i posthtml posthtml-postcss-treeshaker
Usage
Describe how people can use this plugin. Include info about build systems if it's necessary.
const fs = require("fs");
const posthtml = require("posthtml");
const posthtmlPlugin = require("posthtml-postcss-treeshaker");
posthtml()
.use(
posthtmlPlugin({
/* options */
})
)
.process(html /*, options */)
.then(result => fs.writeFileSync("./after.html", result.html));
Contributing
See PostHTML Guidelines and contribution guide.