postcss-minify-gradients

Minify gradient parameters with PostCSS.

Usage no npm install needed!

<script type="module">
  import postcssMinifyGradients from 'https://cdn.skypack.dev/postcss-minify-gradients';
</script>

README

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