postcss-modify-numbers

PostCSS plugin that performs math operations on all numbers with a certain property


Keywords
postcss, css, postcss-plugin, math, numbers, add, subtract, multiply, divide, modify
License
MIT
Install
npm install postcss-modify-numbers@0.0.3

Documentation

PostCSS Modify Numbers Build Status

PostCSS plugin that performs math operations on all numbers with a certain property.

Installation

$ npm install postcss-modify-numbers

Usage

postcss([
    require('postcss-modify-numbers')({
        property: "width",
        operation: "multiply",
        number: 1.3
    })
])
/* Input example */
.foo {
    width: 50px; 
    height: 30px;
}

.bar {
    width: 100px;
    height: 60px;
}
/* Output example */
.foo {
  width: 65px; /* Multiplied by 1.3 */
  height: 30px;
}

.bar {
    width: 130px; /* Multiplied by 1.3 */
    height: 60px;
}

Options

Property

What CSS property you would like to affect, currently only supports one.

Operation

What operation you would like to perform ('add','subtract','divide','multiple')

Number

The number you would like modify the number by

Decimals

The number of decimal places to round to (default is 3)

See PostCSS docs for examples for your environment.