Socket
Socket
Sign inDemoInstall

postcss-minify-gradients

Package Overview
Dependencies
7
Maintainers
7
Versions
43
Alerts
File Explorer

Advanced tools

Install Socket

Protect your apps from supply chain attacks

Install

postcss-minify-gradients

Minify gradient parameters with PostCSS.

    6.0.2latest
    GitHub
    npm

Version published
Maintainers
7
Weekly downloads
11,315,249
increased by3.34%

Weekly downloads

Package description

What is postcss-minify-gradients?

The postcss-minify-gradients npm package is a plugin for PostCSS, a tool for transforming CSS with JavaScript. This plugin reduces the size of gradient definitions in CSS by converting linear-gradient and radial-gradient functions to their more concise forms when possible, thus optimizing the CSS for better performance.

What are postcss-minify-gradients's main functionalities?

Minify linear gradients

Converts verbose linear gradient definitions to shorter equivalents when possible, without changing the visual appearance of the gradient.

require('postcss-minify-gradients')

Minify radial gradients

Optimizes radial gradient definitions by simplifying their syntax and removing unnecessary parts.

require('postcss-minify-gradients')

Convert repeating gradients

Transforms repeating linear-gradient and repeating radial-gradient functions into their more compact forms if it results in smaller CSS size.

require('postcss-minify-gradients')

Other packages similar to postcss-minify-gradients

Readme

Source

postcss-minify-gradients

Minify gradient parameters with PostCSS.

Install

With npm do:

npm install postcss-minify-gradients

Example

Where possible, this module will minify gradient parameters. It can convert linear gradient directional syntax to angles, remove the unnecessary 0% and 100% start and end values, and minimise color stops that use the same length values (the browser will adjust the value automatically).

Input

h1 {
    background: linear-gradient(to bottom, #ffe500 0%, #ffe500 50%, #121 50%, #121 100%)
}

Output

h1 {
    background: linear-gradient(180deg, #ffe500, #ffe500 50%, #121 0, #121)
}

Usage

See the PostCSS documentation for examples for your environment.

Contributors

See CONTRIBUTORS.md.

License

MIT © Ben Briggs

Keywords

FAQs

Last updated on 24 Feb 2024

Did you know?

Socket installs a GitHub app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the 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