Node's Pastoral Musicians

    postcss-values-parser
    TypeScript icon, indicating that this package has built-in type declarations

    6.0.2 • Public • Published


    postcss-values-parser tests cover size

    A CSS property value parser built upon PostCSS, following the same node and traversal patterns as PostCSS.

    Install

    Using npm:

    npm install postcss-values-parser --save-dev

    Please consider becoming a patron if you find this module useful.

    Requirements

    postcss-values-parser Node version v6.14.0+ and PostCSS v7.0.0+.

    Benefits

    • Leverages PostCSS and its tokenizer under the hood
    • Doesn't strip characters; eg. parenthesis
    • Full AST traversal
    • Ability to walk the AST for every Node type
    • Convenience methods to stringify Nodes
    • Follows PostCSS patterns for whitespace between Nodes
    • Provides convenience properties for number units, colors, etc.

    Usage

    Using the parser is straightforward and minimalistic:

    const { parse } = require('postcss-values-parser');
    
    const root = parse('#fff');
    const node = root.first;
    
    // → Word {
    //     raws: { before: '', after: '' },
    //     value: '#fff',
    //     type: 'word',
    //     isHex: true,
    //     isColor: true,
    //     isVariable: false,
    //     ...
    //   }

    Please see the Documentation for further information on using the module.

    Meta

    CONTRIBUTING

    LICENSE (Mozilla Public License)

    Install

    npm i postcss-values-parser

    DownloadsWeekly Downloads

    5,626,964

    Version

    6.0.2

    License

    MPL-2.0

    Unpacked Size

    63.1 kB

    Total Files

    21

    Last publish

    Collaborators

    • shellscape