Slick CSS 🎈
No more bloated CSS styles 💩 in your websites.
How it works?
- It intercepts the res.render method in the express framework
- Strips out all the stylesheets from the html document
- Extracts only used styles using uncss
- Creates a new stylesheet in the path specified(cssPath) and caches it
- Adds the newly created stylesheet to the html document
- Send the response
How to use it?
- Install the package
npm install express-slick-css --save
- Add all the stylesheets to the layout
...<!-- rel='stylesheet' must be there otherwise it won't be picked up -->...
- Add the middleware before all the routes
const slickify = ;...app;...app;
Options
Options | Description | Mandatory | Default Value |
---|---|---|---|
outputPath | path to save the new slick stylesheets | Yes | N/A |
cssPath | path to look for stylesheets specified in link tag | No | outputPath |
publicPath | public path for serving css asset eg. href="/css/style.css" |
No | '/' |
uncssOptions | Supports all the options provided by uncss | No | Refer uncss |
Example
app;
How to contribute?
Feel free to create an issue for a feature request, bug and you can take up any of those to make a pull request
Show your support by ⭐️ the repo
License
MIT © Ameer Jhan