bg-size-parser

    0.1.0 • Public • Published

    Background Size Parser

    Parses values for the CSS background-size property.

    Usage

    The parse method takes any valid background-size property as a string.

    const { parse } = require('bg-size-parser');
     
    parse('3em 25%');
     
    // [{
    //   width: { size: 3, unit: 'em' },
    //   height: { size: 25, unit: '%' }
    // }]
     
    parse('cover');
     
    // [{
    //   keyword: 'cover'
    // }]
     
    parse('6px, auto, contain');
     
    // [
    //   {
    //     width: { size: 6, unit: 'px' },
    //     height: { size: 'auto' }
    //   },
    //   {
    //     width: { size: 'auto' },
    //     height: { size: 'auto' }
    //   },
    //   { keyword: 'contain' }
    // ]

    Install

    npm i bg-size-parser

    DownloadsWeekly Downloads

    5

    Version

    0.1.0

    License

    ISC

    Unpacked Size

    18.9 kB

    Total Files

    3

    Last publish

    Collaborators

    • dawaltconley