npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

express-slick-css

v1.0.0

Published

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

Downloads

6

Readme

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

| 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.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