https://github.com/alex-ketch/metalsmith-purifycss
PurifyCSS plugin for Metalsmith static site generator
https://github.com/alex-ketch/metalsmith-purifycss
css metalsmith metalsmith-plugin purifycss
Last synced: 7 months ago
JSON representation
PurifyCSS plugin for Metalsmith static site generator
- Host: GitHub
- URL: https://github.com/alex-ketch/metalsmith-purifycss
- Owner: alex-ketch
- Created: 2017-05-13T21:51:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-06T21:30:38.000Z (almost 3 years ago)
- Last Synced: 2025-04-17T13:37:42.759Z (7 months ago)
- Topics: css, metalsmith, metalsmith-plugin, purifycss
- Language: JavaScript
- Size: 113 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Metalsmith PurifyCSS
[](https://travis-ci.org/alex-ketch/metalsmith-purifycss)
This is a [Metalsmith](http://www.metalsmith.io) plugin for [PurifyCSS](https://github.com/purifycss/purifycss).
---
## Installation
To install run:
```js
npm install metalsmith-purifycss --save-dev
```
or if you're using [Yarn](https://yarnpkg.com)
```js
yarn add metalsmith-purifycss --dev
```
---
## Usage
The API interface is [mostly the same](https://github.com/purifycss/purifycss#api-in-depth) as PurifyCSS.
### Additional options:
| Key | Type | Description |
| :--------------- | :------ | :--------------------------------------------------------- |
| `removeOriginal` | boolean | Removes files matched by the `css` option from the output. |
This is the simplest setup:
```js
const purifyCSS = require('metalsmith-purifycss');
Metalsmith()
// ... Compile CSS/HTML/JavaScript
.use(purifyCSS({
content: ['*.html', '*.js'],
css: ['styles.css'],
output: 'styles-purified.css',
}))
.build((err, files) => {
if (err) throw new err;
});
});
```
Note that if you'd like to overwrite the original CSS file, set the `output`
name to match the `css` filename.