How to use cssstats - 1 common examples

To help you get started, we’ve selected a few cssstats examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sndrs / postcss-atomised / src / index.js View on Github external
const atomise = (css, result, mapPath, mapHandler) => {
    reportStats(result, stats(css.toString()), 'magenta', 'Found:    ');

    // We'll create a new root of atomic classes to eventually return in the result
    const newRoot = [];

    // We also need a place to store the map of original classnames to the atomic ones
    const atomicMap = {};

    // Prepare the CSS for parsing:

    // 1. get single instances of each selector if its a list
    unchainSelectors(css); // .a, .b {} => .a {}; .b {}

    // 2. merge rules with the same selector if they have the same container (root, at-rule etc)
    mergeRulesBySelector(css); // .a {}; .a {} => .a {}

    // 3. expand shorthand rules

cssstats

High-level stats for stylesheets

MIT
Latest version published 3 years ago

Package Health Score

59 / 100
Full package analysis

Popular cssstats functions