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

3.0.2 • Public • Published

postcss-replace-values

npm GitHub issues GitHub Workflow Status (with event)

Install

npm install --save postcss postcss-replace-values

Upgrade from v2 to v3

You now need to install postcss as a dependency in your project. This allows to update this on your own.

Simple Usage

const postcss = require('postcss');
const replaceValuesPlugin = require('postcss-replace-values');

postcss()
  .use(replaceValuesPlugin({ 
    values: {
      '#000': '#a00'
    }
  }))

Input CSS:

body {
  color: #000;
}

Output CSS:

body {
  color: #a00;
}

Regex Usage

Only if the selector is matching the regex, the value will be replaced.

const postcss = require('postcss');
const replaceValuesPlugin = require('postcss-replace-values');

postcss()
  .use(replaceValuesPlugin({ 
    values: {
      '#000': { value: '#a00', selector: /btn/ }
    }
  }))

Input CSS:

body {
  color: #000;
}
.btn {
  color: #000;
}

Output CSS:

body {
  color: #000;
}
.btn {
  color: #a00;
}

License

MIT

/postcss-replace-values/

    Package Sidebar

    Install

    npm i postcss-replace-values

    Weekly Downloads

    1,111

    Version

    3.0.2

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    9

    Last publish

    Collaborators

    • wuifdesign