posthtml-postcss-treeshaker

0.3.0 • Public • Published

posthtml-postcss-treeshaker

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

NPM Deps Build [![Coverage][cover]][cover-badge] 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

Package Sidebar

Install

npm i posthtml-postcss-treeshaker

Weekly Downloads

2

Version

0.3.0

License

MIT

Unpacked Size

6.27 kB

Total Files

5

Last publish

Collaborators

  • anixsaha