12.0.3 • Published 4 years ago

@fela-next/fela-statistics v12.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

fela-statistics

Statistic generation tool for Fela. It collects several information and metrics to better analyze your application CSS. Right now, it provides the following information:

  • Class count
    • per media query
    • with/without pseudo class
  • Usage per class
  • CSS file size
    • in bytes, kbytes, bytes (gzipped) and kbytes (gzipped)
  • Reuse
    • Reuse ratio (total used classes vs. total unique classes)
  • total classes with pseudo classes
  • total classes inside media queries
  • total renders
  • total used classes

Installation

yarn add fela-statistics

You may alternatively use npm i --save fela-statistics.

Usage

Adding the statistics enhancer will add a new function to the renderer called getStatistics. You may call it at any given time, to get the current statistics object.

import { createRenderer } from '@fela-next/fela'
import statistics from '@fela-next/fela-statistics'

const renderer = createRenderer({
  enhancers: [ statistics() ]
})

// rendering stuff

const stats = renderer.getStatistics()
console.log(stats)

Example

License

Fela is licensed under the MIT License. Documentation is licensed under Creative Common License. Created with ♥ by @robinweser and all the great contributors.