Last active
January 15, 2019 18:24
-
-
Save oleersoy/81afac18b450ef45eb7ede6ddbeac978 to your computer and use it in GitHub Desktop.
postcss uncss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const postcss = require('postcss') | |
| const fs = require('fs') | |
| const options = { | |
| html: ['html/*.html'] | |
| } | |
| fs.readFile('css/index.css','utf8', (err, css) => { | |
| postcss([require('postcss-uncss')(options)]) | |
| .process(css, { from: 'css/app.css', to: 'css/filtered.css' }) | |
| .then(result => { | |
| fs.writeFile('css/filtered.css', result.css, () => true) | |
| if ( result.map ) { | |
| fs.writeFile('dest/app.css.map', result.map, () => true) | |
| } | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment