CSS Statistics
Parses stylesheets and returns an object with statistics
Used in http://cssstats.com
Usage
var fs = ;var cssstats = ; var css = fs;var obj = ;
Returned Object
size
The size of the file 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 the reworkcss/css
AST object. This array serves as the reference point for other parts of the declarations
object.
declarations.byProperty
An object with keys for each property found in the stylesheet.
declarations.byProperty[key]
An array of indexes for declarations with the property key. Use the index to find the full declaration in declarations.all
.
declarations.unique[key]
Similar to declarations.byProperty
, but only lists the first unique value for each property.
declarations.byMedia[key]
Similar to declarations.byProperty
, but only lists declarations in the @media
rule key.
rules
Flattened array of rules from the reworkcss/css
AST object.
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 -
fontSizes.total
- total number of font-size declarations -
fontSizes.unique
- number of unique font-size declarations -
floats.total
- total number of float declarations -
floats.unique
- number of unique float declarations -
widths.total
- total number of width declarations -
widths.unique
- number of unique width declarations -
heights.total
- total number of height declarations -
heights.unique
- number of unique height declarations -
colors.total
- total number of color declarations -
colors.unique
- number of unique color declarations -
backgroundColors.total
- total number of background-color declarations -
backgroundColors.unique
- number of unique background-color declarations
Truncated Sample Object