postcss-convert-values
Convert values with PostCSS (e.g. ms -> s)
Last updated 2 years ago by ai .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install postcss-convert-values 
SYNC missed versions from official npm registry.

postcss-convert-values

Convert values with PostCSS (e.g. ms -> s)

Install

With npm do:

npm install postcss-convert-values --save

Example

This plugin reduces CSS size by converting values to use different units where possible; for example, 500ms can be represented as .5s. You can read more about these units in this article.

Input

h1 {
    font-size: 16px;
    width: 0em
}

Output

h1 {
    font-size: 1pc;
    width: 0
}

Note that this plugin only covers conversions for duration and absolute length values. For color conversions, use [postcss-colormin][colormin].

API

convertValues([options])

options

length

Type: boolean Default: true

Pass false to disable conversion from px to other absolute length units, such as pc & pt & vice versa.

time

Type: boolean Default: true

Pass false to disable conversion from ms to s & vice versa.

angle

Type: boolean Default: true

Pass false to disable conversion from deg to turn & vice versa.

precision

Type: boolean|number Default: false

Specify any numeric value here to round px values to that many decimal places; for example, using {precision: 2} will round 6.66667px to 6.67px, and {precision: 0} will round it to 7px. Passing false (the default) will leave these values as is.

It is recommended for most use cases to set this option to 2.

Usage

See the PostCSS documentation for examples for your environment.

Contributors

See CONTRIBUTORS.md.

License

MIT © Ben Briggs

Current Tags

  • 4.0.1                                ...           latest (2 years ago)
  • 4.0.0-rc.2                                ...           next (3 years ago)
  • 4.0.0-nightly.2020.1.11                                ...           nightly (8 days ago)

51 Versions

  • 4.0.0-nightly.2020.1.11                                ...           8 days ago
  • 4.0.0-nightly.2020.1.9                                ...           10 days ago
  • 4.0.0-nightly.2020.10.20                                ...           3 months ago
  • 4.0.0-nightly.2020.9.9                                ...           4 months ago
  • 4.0.0-nightly.2020.9.3                                ...           5 months ago
  • 4.0.0-nightly.2020.9.1                                ...           5 months ago
  • 4.0.0-nightly.2020.8.29                                ...           5 months ago
  • 4.0.0-nightly.2020.8.25                                ...           5 months ago
  • 4.0.0-nightly.2020.8.24                                ...           5 months ago
  • 4.0.0-nightly.2020.8.17                                ...           5 months ago
  • 4.0.0-nightly.2020.8.10                                ...           5 months ago
  • 4.0.0-nightly.2020.8.4                                ...           6 months ago
  • 4.0.0-nightly.2020.8.1                                ...           6 months ago
  • 4.0.0-nightly.2020.7.31                                ...           6 months ago
  • 4.0.0-nightly.2020.7.25                                ...           6 months ago
  • 4.0.0-nightly.2020.7.24                                ...           6 months ago
  • 4.0.1                                ...           2 years ago
  • 4.0.0                                ...           3 years ago
  • 4.0.0-rc.2                                ...           3 years ago
  • 4.0.0-rc.0                                ...           4 years ago
  • 2.6.1                                ...           4 years ago
  • 2.6.0                                ...           4 years ago
  • 2.5.0                                ...           4 years ago
  • 2.4.1                                ...           4 years ago
  • 2.4.0                                ...           5 years ago
  • 2.3.6                                ...           5 years ago
  • 2.3.5                                ...           5 years ago
  • 2.3.4                                ...           5 years ago
  • 2.3.3                                ...           5 years ago
  • 2.3.2                                ...           5 years ago
  • 2.3.1                                ...           5 years ago
  • 2.3.0                                ...           5 years ago
  • 2.2.1                                ...           5 years ago
  • 2.2.0                                ...           5 years ago
  • 2.1.0                                ...           5 years ago
  • 2.0.1                                ...           5 years ago
  • 2.0.0                                ...           5 years ago
  • 1.3.1                                ...           5 years ago
  • 1.3.0                                ...           5 years ago
  • 1.2.5                                ...           5 years ago
  • 1.2.4                                ...           5 years ago
  • 1.2.3                                ...           6 years ago
  • 1.2.2                                ...           6 years ago
  • 1.2.1                                ...           6 years ago
  • 1.2.0                                ...           6 years ago
  • 1.1.1                                ...           6 years ago
  • 1.1.0                                ...           6 years ago
  • 1.0.3                                ...           6 years ago
  • 1.0.2                                ...           6 years ago
  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago

Copyright 2014 - 2017 © taobao.org |