File tree Expand file tree Collapse file tree 3 files changed +34
-1
lines changed
packages/postcss-if-function Expand file tree Collapse file tree 3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -16,12 +16,27 @@ npm install postcss-if-function postcss
16
16
17
17
## Usage
18
18
19
- ### Basic Usage
19
+ ### PostCSS CLI
20
+
21
+ ``` bash
22
+ # Transform CSS using PostCSS CLI
23
+ npx postcss input.css --output output.css --use postcss-if-function
24
+
25
+ # With custom PostCSS config file
26
+ npx postcss input.css --output output.css --config postcss.config.js
27
+ ```
28
+
29
+ ### Basic Programmatic Usage
20
30
21
31
``` js
32
+ // Named export (recommended)
22
33
import postcss from " postcss" ;
23
34
import { postcssIfFunction } from " postcss-if-function" ;
24
35
36
+ // Or default export (for compatibility)
37
+ import postcss from " postcss" ;
38
+ import postcssIfFunction from " postcss-if-function" ;
39
+
25
40
const css = `
26
41
.example {
27
42
color: if(media(max-width: 768px): blue; else: red);
@@ -69,6 +84,21 @@ const result = await postcss([
69
84
]).process (css, { from: undefined });
70
85
```
71
86
87
+ ### With PostCSS Config File
88
+
89
+ ``` js
90
+ // postcss.config.js
91
+ import { postcssIfFunction } from " postcss-if-function" ;
92
+
93
+ export default {
94
+ plugins: [
95
+ postcssIfFunction ({
96
+ logTransformations: process .env .NODE_ENV === " development"
97
+ })
98
+ ]
99
+ };
100
+ ```
101
+
72
102
### With Popular PostCSS Tools
73
103
74
104
#### Vite
Original file line number Diff line number Diff line change @@ -33,3 +33,5 @@ export function postcssIfFunction(
33
33
export namespace postcssIfFunction {
34
34
const postcss : boolean ;
35
35
}
36
+
37
+ export default postcssIfFunction ;
Original file line number Diff line number Diff line change @@ -119,3 +119,4 @@ function postcssIfFunction(options = {}) {
119
119
postcssIfFunction . postcss = true ;
120
120
121
121
export { postcssIfFunction } ;
122
+ export default postcssIfFunction ;
You can’t perform that action at this time.
0 commit comments