source: frontend/node_modules/postcss-double-position-gradients/README.md

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 4.2 KB
Line 
1# PostCSS Double Position Gradients [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS" width="90" height="90" align="right">][postcss]
2
3[<img alt="NPM Version" src="https://img.shields.io/npm/v/postcss-double-position-gradients.svg" height="20">][npm-url]
4[<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/double-position-gradients.svg" height="20">][css-url]
5[<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord]
6
7[PostCSS Double Position Gradients] lets you use double-position gradients in
8CSS, following the [CSS Image Values and Replaced Content] specification.
9
10```pcss
11.linear-gradient {
12 background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
13}
14
15.conic-gradient {
16 background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
17}
18
19/* becomes */
20
21.linear-gradient {
22 background-image: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%);
23 background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
24}
25
26.conic-gradient {
27 background-image: conic-gradient(yellowgreen 40%, gold 0deg, gold 75%, #f06 0deg);
28 background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
29}
30```
31
32## Usage
33
34Add [PostCSS Double Position Gradients] to your project:
35
36```bash
37npm install postcss-double-position-gradients --save-dev
38```
39
40Use [PostCSS Double Position Gradients] to process your CSS:
41
42```js
43const postcssDoublePositionGradients = require('postcss-double-position-gradients');
44
45postcssDoublePositionGradients.process(YOUR_CSS /*, processOptions, pluginOptions */);
46```
47
48Or use it as a [PostCSS] plugin:
49
50```js
51const postcss = require('postcss');
52const postcssDoublePositionGradients = require('postcss-double-position-gradients');
53
54postcss([
55 postcssDoublePositionGradients(/* pluginOptions */)
56]).process(YOUR_CSS /*, processOptions */);
57```
58
59[PostCSS Double Position Gradients] runs in all Node environments, with special instructions for:
60
61| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Create React App](INSTALL.md#create-react-app) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) |
62| --- | --- | --- | --- | --- | --- |
63
64## Options
65
66### preserve
67
68The `preserve` option determines whether the original double-position gradients
69should be preserved. By default, double-position gradients are preserved.
70
71```js
72postcssDoublePositionGradients({ preserve: false })
73```
74
75```css
76.linear-gradient {
77 background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
78}
79
80.conic-gradient {
81 background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
82}
83
84/* becomes */
85
86.linear-gradient {
87 background-image: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%);
88}
89
90.conic-gradient {
91 background-image: conic-gradient(yellowgreen 40%, gold 0deg, gold 75%, #f06 0deg);
92}
93```
94
95### enableProgressiveCustomProperties
96
97The `enableProgressiveCustomProperties` option determines whether the original notation
98is wrapped with `@supports` when used in Custom Properties. By default, it is enabled.
99
100⚠️ We only recommend disabling this when you set `preserve` to `false` or if you bring your own fix for Custom Properties. See what the plugin does in its [README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties#readme).
101
102```js
103postcssDoublePositionGradients({ enableProgressiveCustomProperties: false })
104```
105
106```pcss
107:root {
108 --a-gradient: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
109}
110
111/* becomes */
112
113:root {
114 --a-gradient: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%); /* will never be used, not even in older browser */
115 --a-gradient: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
116}
117```
118
119[css-url]: https://cssdb.org/#double-position-gradients
120[discord]: https://discord.gg/bUadyRwkJS
121[npm-url]: https://www.npmjs.com/package/postcss-double-position-gradients
122
123[CSS Image Values and Replaced Content]: https://www.w3.org/TR/css-images-4/#color-stop-syntax
124[PostCSS]: https://github.com/postcss/postcss
125[PostCSS Double Position Gradients]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-double-position-gradients
Note: See TracBrowser for help on using the repository browser.