1- <!-- Available Variables: -->
2- <!-- Blank Pseudo PostCSS Your Plugin -->
3- <!-- blankPseudo postcssYourPlugin -->
4- <!-- css-blank-pseudo @csstools/postcss-your-plugin -->
5- <!-- plugins/css-blank-pseudo plugins/postcss-your-plugin -->
6- <!-- blank-pseudo-class your-feature -->
7- <!-- https://www.w3.org/TR/selectors-4/#blank https://www.w3.org/TR/css-color-4/#funcdef-color -->
8- <!-- input:blank {
9- background-color: yellow;
10- } file contents for examples/example.css -->
11- <!-- # Blank Pseudo [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][postcss]
12-
13- [<img alt="npm version" src="https://img.shields.io/npm/v/css-blank-pseudo.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/blank-pseudo-class.svg" height="20">][css-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord] -->
14- <!-- ## Usage
15-
16- Add [Blank Pseudo] to your project:
17-
18- ```bash
19- npm install postcss css-blank-pseudo --save-dev
20- ```
21-
22- Use it as a [PostCSS] plugin:
23-
24- ```js
25- const postcss = require('postcss');
26- const blankPseudo = require('css-blank-pseudo');
27-
28- postcss([
29- blankPseudo(/* pluginOptions */)
30- ]).process(YOUR_CSS /*, processOptions */);
31- ``` usage instructions -->
32- <!-- [Blank Pseudo] runs in all Node environments, with special
33- instructions for:
34-
35- | [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) |
36- | --- | --- | --- | --- | --- | --- | -->
37- <!-- ## CORS
38-
39- ⚠️ Applies to you if you load CSS from a different domain than the page.
40-
41- In this case the CSS is treated as untrusted and will not be made available to the JavaScript polyfill.
42- The polyfill will not work without applying the correct configuration for CORS.
43-
44- Example :
45-
46- | page | css | CORS applies |
47- | --- | --- | --- |
48- | https://example.com/ | https://example.com/style.css | no |
49- | https://example.com/ | https://other.com/style.css | yes |
50-
51-
52- **You might see one of these error messages :**
53-
54- Chrome :
55-
56- > DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet': Cannot access rules
57-
58- Safari :
59-
60- > SecurityError: Not allowed to access cross-origin stylesheet
61-
62- Firefox :
63-
64- > DOMException: CSSStyleSheet.cssRules getter: Not allowed to access cross-origin stylesheet
65-
66- To resolve CORS errors you need to take two steps :
67-
68- - add an HTTP header `Access-Control-Allow-Origin: <your-value>` when serving your CSS file.
69- - add `crossorigin="anonymous"` to the `<link rel="stylesheet">` tag for your CSS file.
70-
71- In a node server setting the HTTP header might look like this :
72-
73- ```js
74- // http://localhost:8080 is the domain of your page!
75- res.setHeader('Access-Control-Allow-Origin', 'https://example.com');
76- ```
77-
78- You can also configure a wildcard but please be aware that this might be a security risk.
79- It is better to only set the header for the domain you want to allow and only on the responses you want to allow.
1+ # PostCSS Blank Pseudo [ <img src =" https://postcss.github.io/postcss/logo.svg " alt =" PostCSS Logo " width =" 90 " height =" 90 " align =" right " >] [ postcss ]
802
81- HTML might look like this :
3+ [ < img alt = " npm version " src = " https://img.shields.io/npm/v/css-blank-pseudo.svg " height = " 20 " > ] [ npm-url ] [ < img alt = " CSS Standard Status " src = " https://cssdb.org/images/badges/blank-pseudo-class.svg " height = " 20 " > ] [ css-url ] [ < img alt = " Build Status " src = " https://github.com/csstools/postcss-plugins/workflows/test/badge.svg " height = " 20 " > ] [ cli-url ] [ < img alt = " Discord " src = " https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white " > ] [ discord ]
824
83- ```html
84- <link rel="stylesheet" href="https://example.com/styles.css" crossorigin="anonymous">
85- ```
86- -->
87- <!-- [cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
88- [css-url]: https://cssdb.org/#blank-pseudo-class
89- [discord]: https://discord.gg/bUadyRwkJS
90- [npm-url]: https://www.npmjs.com/package/css-blank-pseudo
91-
92- [Gulp PostCSS]: https://github.com/postcss/gulp-postcss
93- [Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
94- [PostCSS]: https://github.com/postcss/postcss
95- [PostCSS Loader]: https://github.com/postcss/postcss-loader
96- [Blank Pseudo]: https://github.com/csstools/postcss-plugins/tree/main/plugins/css-blank-pseudo -->
97- <!-- to generate : npm run docs -->
98-
99- <header >
100-
101- [ Blank Pseudo] lets you style form elements when they are empty, following
5+ [ PostCSS Blank Pseudo] lets you style form elements when they are empty, following
1026the [ Selectors Level 4] specification.
1037
1048``` pcss
@@ -116,9 +20,30 @@ input:blank {
11620}
11721```
11822
119- < usage >
23+ ## Usage
12024
121- <envSupport >
25+ Add [ PostCSS Blank Pseudo] to your project:
26+
27+ ``` bash
28+ npm install postcss css-blank-pseudo --save-dev
29+ ```
30+
31+ Use it as a [ PostCSS] plugin:
32+
33+ ``` js
34+ const postcss = require (' postcss' );
35+ const postcssBlankPseudo = require (' css-blank-pseudo' );
36+
37+ postcss ([
38+ postcssBlankPseudo (/* pluginOptions */ )
39+ ]).process (YOUR_CSS /* , processOptions */ );
40+ ```
41+
42+ [ PostCSS Blank Pseudo] runs in all Node environments, with special
43+ instructions for:
44+
45+ | [ 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 ) |
46+ | --- | --- | --- | --- | --- | --- |
12247
12348## Options
12449
@@ -128,7 +53,7 @@ The `preserve` option determines whether the original notation
12853is preserved. By default, it is preserved.
12954
13055``` js
131- blankPseudo ({ preserve: false })
56+ postcssBlankPseudo ({ preserve: false })
13257```
13358
13459``` pcss
@@ -149,7 +74,7 @@ The `replaceWith` option determines the selector to use when replacing
14974the ` :blank ` pseudo. By default is ` [blank] `
15075
15176``` js
152- blankPseudo ({ replaceWith: ' .css-blank' })
77+ postcssBlankPseudo ({ replaceWith: ' .css-blank' })
15378```
15479
15580``` pcss
188113<script >cssBlankPseudoInit () </script >
189114```
190115
191- [ Blank Pseudo] works in all major browsers, including Safari 6+ and
116+ [ PostCSS Blank Pseudo] works in all major browsers, including Safari 6+ and
192117Internet Explorer 9+ without any additional polyfills.
193118
194119This plugin conditionally uses ` MutationObserver ` to ensure recently inserted
@@ -225,5 +150,14 @@ cssBlankPseudoInit({ replaceWith: '.css-blank' });
225150
226151This option should be used if it was changed at PostCSS configuration level.
227152
228- <linkList >
153+ [ cli-url ] : https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test
154+ [ css-url ] : https://cssdb.org/#blank-pseudo-class
155+ [ discord ] : https://discord.gg/bUadyRwkJS
156+ [ npm-url ] : https://www.npmjs.com/package/css-blank-pseudo
157+
158+ [ Gulp PostCSS ] : https://github.com/postcss/gulp-postcss
159+ [ Grunt PostCSS ] : https://github.com/nDmitry/grunt-postcss
160+ [ PostCSS ] : https://github.com/postcss/postcss
161+ [ PostCSS Loader ] : https://github.com/postcss/postcss-loader
162+ [ PostCSS Blank Pseudo ] : https://github.com/csstools/postcss-plugins/tree/main/plugins/css-blank-pseudo
229163[ Selectors Level 4 ] : https://www.w3.org/TR/selectors-4/#blank
0 commit comments