This `postRenderer` plugin for [Scully](http://scully.io/) will remove unused CSS from the HTML of your prerendered pages.
npm install scully-plugin-remove-unused-cssThis postRenderer plugin for Scully will remove unused CSS from the HTML of your prerendered pages.
Plugin will remove unnecessary CSS code from rendered Scully static HTMLs,
which will decrease the size of your pages and drastically improve loading times.
Highly recommended to use this plugin along with CSS libraries like Angular Material.
To install this library with npm run
```
$ npm install scully-plugin-remove-unused-css --save-devyarn
or with ``
$ yarn add scully-plugin-remove-unused-css --dev
This package depends on packages:
- extract-css
- PurgeCSS
Both will be installed during scully-remove-unused-css installation.
Import and add the plugin to the defaultPostRenderers to execute it on all rendered pages postRenderers
or use the on a route configuration to execute it for a specific route.
`js
const { RouteTypes } = require('@scullyio/scully');
const { RemoveUnusedCSSPlugin } = require('scully-plugin-remove-unused-css');
exports.config = {
projectRoot: './src/app',
defaultPostRenderers: [RemoveUnusedCSSPlugin], // for all routes
routes: {
'/blog/:slug': {
type: RouteTypes.contentFolder,
slug: {
folder: "./blog"
},
postRenderers: [RemoveUnusedCSSPlugin] // per route config
},
}
};
`
Now build your app and then just run the Scully command.
`shell script``
npm run build --prod
npm run scully
More info on getting started with Scully can be found on their homepage.