Security News
NVD Backlog Tops 20,000 CVEs Awaiting Analysis as NIST Prepares System Updates
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
postcss-convert-values
Advanced tools
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.
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; }"
cssnano is a modular CSS minifier that includes functionalities similar to postcss-convert-values as part of its optimizations. It can compress colors, remove comments, and deduplicate rules among other features, making it more comprehensive than postcss-convert-values.
clean-css is another CSS minifier and optimizer that can perform optimizations similar to postcss-convert-values, such as shortening color values and removing unnecessary characters. It offers a wide range of optimizations and is known for its balance between speed and efficiency.
Convert values with PostCSS (e.g. ms -> s)
With npm do:
npm install postcss-convert-values --save
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.
h1 {
font-size: 16px;
width: 0em
}
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.
Pull requests are welcome. If you add functionality, then please add unit tests to cover it.
MIT © Ben Briggs
FAQs
Convert values with PostCSS (e.g. ms -> s)
The npm package postcss-convert-values receives a total of 9,051,098 weekly downloads. As such, postcss-convert-values popularity was classified as popular.
We found that postcss-convert-values demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 8 open source maintainers collaborating on the project.
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.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.