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 🙏

© 2025 – Pkg Stats / Ryan Hefner

helium-cli

v1.1.0

Published

A tool to detect unused CSS across multiple web pages

Readme

Helium CLI

A command-line tool to discovery unused CSS accros multiple pages based on phantomjs, which is inspired by project helium-css.

Installation

If you want a standalone cli tool, just run(highly suggest):

npm install -g helium-cli

If you already has phantomjs installed and also curl in your machine, and you really don't want to download phantomjs again due to some reason. Then you can clone this repository and remove the "phantomjs" "request" dependencies in the package.json.

Usage

Use in command-line

While you install via npm, then you can run:

helium-cli www.example.com/1 www.example.com/2  

If you already has phantomjs installed and also curl in your machine and clone the repository into your local disk. You can just run:

phantomjs helium-script.js www.example.com/1 www.example.com/2

Command Line Interface

Usage: helium-cli [options] [URLs] -- [phantomjs options]
        -A, --user-agent userAgent will be used when visit URLs
        -e, --referer Referer will be used when visit URLs
        -h, --help show help
        -v, --version show version

Use in node

Now you can use helium-cli pragmatically in node:

   var helium = require('helium-cli');
   
   helium('www.example.com', {
        useAgent: userAgent,
        __: ['arguments pass to phantomjs']
   }, function(err, data) {
        // analyse results
        // data is looks like following : 
        {
          pages: {
            "www.example.com" : {
              err: true, 
              error: new Error('...'),
              msg: 'xxx...'
            }, 
            "www.example1.com": {
              "csses": [{
                "url":"http://www.example1.com/one.css",
                "name": "one.css"
              },
              {
                "url": "http://www.example1.com/ <anonymouse inner-style:0>",
                "name": "<anonymouse inner-style>",
                "body": "...."
              }]
            }
          },
          csses: [{
            "name": "xxx",
            "url": "xxx..",
            "unused": [
                'unused selectors'...
            ],
            "pseudo_class": [
                'pseudo classes'...
            ],
            "invalid_selector": [
                'invalid selectors'...
            ],
            "unused_perc": "54.3" // percentage of unused selectors
            }, {
              "name": "xxx2",
              "url": "xxxx...",
              "err": true,
              "error": new Error('...'),
              "msg": "xxxx..."
          }]
       }
   });
   
   helium(['www.example.com', 'www.example1.com'], function(err, data) {
        // analyse results
        ...
   });
   

TODO

  1. ~~Error handling for webpage loading/parsing errors.~~
  2. Detect css selectors used in javascript.
  3. ~~Psuedo class detect.~~

License

(The BSD License)

Copyright (c) 2013, Villa.Gao [email protected]; All rights reserved.