6.0.0 • Published 5 months ago

postcss-double-position-gradients v6.0.0

Weekly downloads
3,603,313
License
MIT-0
Repository
github
Last release
5 months ago

PostCSS Double Position Gradients

PostCSS Double Position Gradients lets you use double-position gradients in CSS, following the CSS Image Values and Replaced Content specification.

.linear-gradient {
  background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
}

.conic-gradient {
  background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
}

/* becomes */

.linear-gradient {
  background-image: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%);
  background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
}

.conic-gradient {
  background-image: conic-gradient(yellowgreen 40%, gold 0deg, gold 75%, #f06 0deg);
  background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
}

Usage

Add PostCSS Double Position Gradients to your project:

npm install postcss-double-position-gradients --save-dev

Use PostCSS Double Position Gradients to process your CSS:

const postcssDoublePositionGradients = require('postcss-double-position-gradients');

postcssDoublePositionGradients.process(YOUR_CSS /*, processOptions, pluginOptions */);

Or use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssDoublePositionGradients = require('postcss-double-position-gradients');

postcss([
  postcssDoublePositionGradients(/* pluginOptions */)
]).process(YOUR_CSS /*, processOptions */);

PostCSS Double Position Gradients runs in all Node environments, with special instructions for:

NodePostCSS CLIWebpackGulpGrunt

Options

preserve

The preserve option determines whether the original double-position gradients should be preserved. By default, double-position gradients are preserved.

postcssDoublePositionGradients({ preserve: false })
.linear-gradient {
  background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
}

.conic-gradient {
  background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg);
}

/* becomes */

.linear-gradient {
  background-image: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%);
}

.conic-gradient {
  background-image: conic-gradient(yellowgreen 40%, gold 0deg, gold 75%, #f06 0deg);
}

enableProgressiveCustomProperties

The enableProgressiveCustomProperties option determines whether the original notation is wrapped with @supports when used in Custom Properties. By default, it is enabled.

!NOTE 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.

postcssDoublePositionGradients({ enableProgressiveCustomProperties: false })
:root {
	--a-gradient: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
}

/* becomes */

:root {
	--a-gradient: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%); /* will never be used, not even in older browser */
	--a-gradient: linear-gradient(90deg, black 25% 50%, blue 50% 75%);
}
postcss-preset-envsklif-ui-kitsklif-api@everything-registry/sub-chunk-2460sklif-uitest-iki-mini-appresponsis-gantt-task-reactreactofy-css-librarystories-fsstories-react-bdhelp-widgetmicroend-componentmpp_design_sysjulien-easy-modalk0ng_d1nosaur_quenak0ng_d1nosaur_quenbk0ng_d1nosaur_quenck0ng_d1nosaur_quendk0ng_d1nosaur_quenek0ng_d1nosaur_quenfk0ng_d1nosaur_quengk0ng_d1nosaur_quenhk0ng_d1nosaur_quenik0ng_d1nosaur_quenjk0ng_d1nosaur_quenkk0ng_d1nosaur_quenlk0ng_d1nosaur_quenmk0ng_d1nosaur_quennk0ng_d1nosaur_quenok0ng_d1nosaur_quenpk0ng_d1nosaur_quenqk0ng_d1nosaur_quenrk0ng_d1nosaur_quensk0ng_d1nosaur_quentk0ng_d1nosaur_quenuk0ng_d1nosaur_quenvk0ng_d1nosaur_quenwk0ng_d1nosaur_quenxk0ng_d1nosaur_quenyk0ng_d1nosaur_quenzkpackkrown_login_librarymavectraparis-nord-estpostcss-preset-ccbnka-gantt-task-reactpickupbiz-npm-packagepm-gallerymy-library-buttonreact-ang-notifications-honey-comb-setupreact-lightbox-pack-18supportreact-solid-gradient-pickerstyle-guide-mainspacex_cycl3_roamospacex_cycl3_roampspacex_cycl3_roamqspacex_cycl3_roamrspacex_cycl3_roamsspacex_cycl3_roamtspacex_cycl3_roamuspacex_cycl3_roamvspacex_cycl3_roamwspacex_cycl3_roamxspacex_cycl3_roamyspacex_cycl3_roamzspacex_j4vaa_c3qmspacex_j4vad_c3qmspacex_j4vae_c3qmspacex_j4vaf_c3qmspacex_j4vag_c3qmspacex_j4vah_c3qmspacex_j4vai_c3qmspacex_j4vaj_c3qmspacex_j4vajk_c3qmspacex_j4vajl_c3qmspacex_java_c3qcspacex_java_c3qdspacex_java_c3qespacex_java_c3qfspacex_java_c3qgspacex_java_c3qhspacex_java_c3qispacex_java_c3qjspacex_java_c3qkspacex_java_c3qlspacex_java_c3qmspacex_java_c3qnspacex_java_c3qospacex_java_c3qpspacex_java_c3qrspacex_java_c3qsspacex_java_c3qtspacex_java_c3quspacex_java_c3qvspacex_java_c3qwspacex_j4vajzb_c3qmspacex_j4vajzc_c3qmspacex_j4vajzm_c3qmspacex_j4vajzn_c3qmspacex_j4vajzv_c3qm
6.0.0

5 months ago

5.0.7

6 months ago

5.0.6

9 months ago

5.0.5

9 months ago

5.0.4

10 months ago

5.0.3

1 year ago

5.0.2

1 year ago

5.0.1

1 year ago

5.0.0

1 year ago

4.0.4

2 years ago

4.0.3

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.2

2 years ago

3.1.2

2 years ago

3.1.1

3 years ago

3.0.4

3 years ago

3.0.3

3 years ago

3.0.2

3 years ago

3.1.0

3 years ago

3.0.5

3 years ago

3.0.1

3 years ago

3.0.0

3 years ago

2.0.0

5 years ago

1.0.0

6 years ago