posthtml-postcss-treeshaker

A `posthtml` plugin to treeshake class and id styling in `style` tag on html page using `postcss`


Keywords
html, posthtml, posthtml-plugin, postcss
License
MIT
Install
npm install posthtml-postcss-treeshaker@0.1.0

Documentation

posthtml-postcss-treeshaker

A posthtml plugin to treeshake class and id styling in style tag on html page using postcss

PostHTML Plugin Boilerplate

NPM Deps Build Coverage Standard Code Style Chat

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.

License MIT