https://github.com/posthtml/posthtml-postcss-treeshaker
posthtml plugin to tree shake css styles using postcss
https://github.com/posthtml/posthtml-postcss-treeshaker
Last synced: 11 months ago
JSON representation
posthtml plugin to tree shake css styles using postcss
- Host: GitHub
- URL: https://github.com/posthtml/posthtml-postcss-treeshaker
- Owner: posthtml
- License: mit
- Created: 2020-05-13T16:22:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T06:46:15.000Z (about 3 years ago)
- Last Synced: 2024-10-29T21:06:06.936Z (over 1 year ago)
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/posthtml-postcss-treeshaker
- Size: 2.02 MB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: readme.md
- Changelog: CHANGELOG.md
- Contributing: contributing.md
- License: license
Awesome Lists containing this project
README
# posthtml-postcss-treeshaker
A `posthtml` plugin to treeshake class and id styling in `style` tag on html page using `postcss`
[![NPM][npm]][npm-url]
[![Deps][deps]][deps-url]
[![Build][build]][build-badge]
[![Standard Code Style][style]][style-url]
[![Chat][chat]][chat-badge]
This plugin is used for reducing your file size
> Experimental - Work in progress
Before:
```html
HELLO
.used {
color: red;
}
.unused {
color: green;
}
```
After:
```html
HELLO
.used {
color: red;
}
```
## Install
> npm i posthtml posthtml-postcss-treeshaker
## Usage
Describe how people can use this plugin. Include info about build systems if it's
necessary.
```js
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](https://github.com/posthtml/posthtml/tree/master/docs) and [contribution guide](CONTRIBUTING.md).
### License [MIT](LICENSE)
[npm]: https://img.shields.io/npm/v/posthtml-postcss-treeshaker.svg
[npm-url]: https://npmjs.com/package/posthtml-postcss-treeshaker
[deps]: https://david-dm.org/posthtml/posthtml-postcss-treeshaker.svg
[deps-url]: https://david-dm.org/anikethsaha/posthtml-postcss-treeshaker
[style]: https://img.shields.io/badge/code%20style-standard-yellow.svg
[style-url]: http://standardjs.com/
[build]: https://travis-ci.org/posthtml/posthtml-postcss-treeshaker.svg?branch=master
[build-badge]: https://travis-ci.org/posthtml/posthtml?branch=master
[chat]: https://badges.gitter.im/posthtml/posthtml-postcss-treeshaker.svg
[chat-badge]: https://gitter.im/posthtml/posthtml?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"