Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

postcss-convert-values

Package Overview
Dependencies
6
Maintainers
2
Versions
73
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    postcss-convert-values

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


Version published
Weekly downloads
10M
decreased by-0.3%
Maintainers
2
Install size
0.996 MB
Created
Weekly downloads
 

Package description

What is postcss-convert-values?

The postcss-convert-values npm package is designed to optimize CSS size by converting values to use shorter forms where possible. It can reduce CSS file size by converting colors to their shorter hexadecimal or named format, transforming units, and simplifying values without changing their meaning.

What are postcss-convert-values's main functionalities?

Converting Length Units

Converts length values to use the shortest unit representation, removing units from zero values.

"body { margin: 0px; }" -> "body { margin: 0; }"

Converting Colors

Optimizes color values by converting them to shorter named colors or hexadecimal values where possible.

".example { color: #ffffff; }" -> ".example { color: #fff; }"

Simplifying Values

Removes unnecessary decimal places from numerical values to simplify and shorten them.

".container { padding: 50.0px 20.0px; }" -> ".container { padding: 50px 20px; }"

Other packages similar to postcss-convert-values

Readme

Source

postcss-convert-values Build Status NPM version Dependency Status

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.

Contributing

Pull requests are welcome. If you add functionality, then please add unit tests to cover it.

License

MIT © Ben Briggs

Keywords

FAQs

Last updated on 25 Aug 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc