Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cssstats

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cssstats

High-level stats for stylesheets

  • 1.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.1K
decreased by-46.49%
Maintainers
1
Weekly downloads
 
Created
Source

CSS Statistics

Parses stylesheets and returns an object with statistics

Used in http://cssstats.com

Installation

npm install cssstats

Usage

var fs = require('fs');
var cssstats = require('csstats');

var css = fs.readFileSync('./styles.css', 'utf8');
var obj = cssstats(css);

Returned Object

size

The size of the file in bytes

gzipSize

The size of the stylesheet gzipped in bytes

selectors

An array of selectors sorted by source order with the selector string, specificity score, and parts array

declarations

An object of declarations.

declarations.all

An array of declaration objects from PostCSS.

declarations.byProperty

An object with keys for each property found in the stylesheet.

declarations.unique

An object with keys for each unique property/value found in the stylesheet.

declarations.byMedia

An object with keys for each media query found in the stylesheet.

rules

Flattened array of rules from PostCSS.

aggregates

Aggregate data for the entire stylesheet.

  • selectors - total number of selectors
  • declarations - total number of declarations
  • properties - an array of properties used in the stylesheet
  • mediaQueries - an array of media query strings used in the stylesheet

For every unique property found in the stylesheet, aggregates also includes these values:

  • [property].total - total number of [property] declarations
  • [property].unique - number of unique [property] declarations

See the /test folder for example JSON results.

Keywords

FAQs

Package last updated on 27 Jan 2015

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