postcss-custom-selectors
TypeScript icon, indicating that this package has built-in type declarations

7.1.1 • Public • Published

PostCSS Custom Selectors PostCSS Logo

npm version CSS Standard Status Build Status Discord

PostCSS Custom Selectors lets you define @custom-selector in CSS following the Custom Selectors Specification.

@custom-selector :--heading h1, h2, h3;

article :--heading + p {
	margin-top: 0;
}

/* becomes */

article :is(h1, h2, h3) + p {
	margin-top: 0;
}

Usage

Add PostCSS Custom Selectors to your project:

npm install postcss postcss-custom-selectors --save-dev

Use it as a PostCSS plugin:

const postcss = require('postcss');
const postcssCustomSelectors = require('postcss-custom-selectors');

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

PostCSS Custom Selectors runs in all Node environments, with special instructions for:

Options

preserve

The preserve option determines whether the original notation is preserved. By default, it is not preserved.

postcssCustomSelectors({ preserve: true })
@custom-selector :--heading h1, h2, h3;

article :--heading + p {
	margin-top: 0;
}

/* becomes */

@custom-selector :--heading h1, h2, h3;

article :is(h1, h2, h3) + p {
	margin-top: 0;
}

article :--heading + p {
	margin-top: 0;
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
8.0.4648,790latest

Version History

VersionDownloads (Last 7 Days)Published
8.0.4648,790
8.0.35,455
8.0.27,772
8.0.163,007
8.0.02,835
7.1.12313,201
7.1.114,870
7.1.1063,420
7.1.919
7.1.835,387
7.1.717,556
7.1.693,681
7.1.56,926
7.1.429,641
7.1.324,001
7.1.223,086
7.1.11,658
7.1.0783
7.0.044
6.0.32,492,386
6.0.2671
6.0.1163
6.0.0175,982
5.1.21,132,965
5.1.16
5.1.02
5.0.047
4.0.1123,269
4.0.04
3.0.011,318
2.3.01,162
2.2.02
2.1.12
2.1.02
2.0.13
2.0.02
1.1.14
1.1.04
1.0.02

Package Sidebar

Install

npm i postcss-custom-selectors@7.1.1

Version

7.1.1

License

MIT

Unpacked Size

17.7 kB

Total Files

11

Last publish

Collaborators

  • romainmenke
  • alaguna
  • jonathantneal
  • yisi
  • moox
  • semigradsky