New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

express-slick-css

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-slick-css

An express middleware which cleans all the unused css in the template and makes the css slick

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Slick CSS :balloon:

CircleCI codecov tested with jest

No more bloated CSS styles :poop: in your websites.

How it works?

  1. It intercepts the res.render method in the express framework
  2. Strips out all the stylesheets from the html document
  3. Extracts only used styles using uncss
  4. Creates a new stylesheet in the path specified(cssPath) and caches it
  5. Adds the newly created stylesheet to the html document
  6. Send the response

How to use it?

  1. Install the package
npm install express-slick-css --save
  1. Add all the stylesheets to the layout
...
<!-- rel='stylesheet' must be there otherwise it won't be picked up -->
<link href='/stylesheets/style.css' rel='stylesheet'>
...
  1. Add the middleware before all the routes
const slickify = require('express-slick-csss');
...
app.use(slickify(options));
...
app.use('/', indexRoutes);

Options

OptionsDescriptionMandatoryDefault Value
outputPathpath to save the new slick stylesheetsYesN/A
cssPathpath to look for stylesheets specified in link tagNooutputPath
publicPathpublic path for serving css asset eg. href="/css/style.css"No'/'
uncssOptionsSupports all the options provided by uncssNoRefer uncss

Example

app.use(
  slickify({
    cssPath: path.join(__dirname, 'css'),
    // outputPath must exists
    // Add the outputPath to .gitignore if you want
    outputPath: path.join(__dirname, 'slick-css'),
    publicPath: '/stylesheets/',
    uncssOptions: {
      // Include global CSS frameworks here to keep it clean
      stylesheets  : ['lib/bootstrap/dist/css/bootstrap.css']
    }
  });
);

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 :star: the repo

License

MIT © Ameer Jhan

Keywords

FAQs

Package last updated on 13 Aug 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc