Nonchalant Programming Master

    extract-color-properties

    1.0.3 • Public • Published

    extract-color-properties

    Extracts the properties related to the color in the selector that are wrapped in media query.

    Before:

    .foo {
      width: 100px;
      color: white;
      background-color: black;
    }
     
    @media (prefers-color-scheme: dark) {
      .foo {
        width: 100px;
        color: black;
        background-color: white;
      }
    }

    After:

    .foo {
      width: 100px;
      color: white;
      background-color: black;
    }
     
    @media (prefers-color-scheme: dark) {
      .foo {
        color: black;
        background-color: white;
      }
    }

    How to use

    postcss.config.js

    module.exports = {
      plugins: {
        require('extract-color-properties')({ excludeProperties: [''] })
      }
    }

    programmatically

    const {
      extractColorProperties,
    } = require('extract-color-properties/lib/extract-color-properties')
    const result = extractColorProperties('.foo { color: black }')

    Configuration

    • excludeProperties: string[]: Set the properties to be excluded from the deletion target.

    Keywords

    Install

    npm i extract-color-properties

    DownloadsWeekly Downloads

    3

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    6.42 kB

    Total Files

    9

    Last publish

    Collaborators

    • sunya