1
1
[ ![ Build Status] ( https://travis-ci.org/css-modules/icss-utils.svg )] ( https://travis-ci.org/css-modules/icss-utils )
2
2
3
- # ICSS Utils
3
+ # ICSS Utils
4
4
5
5
## replaceSymbols
6
6
@@ -10,9 +10,10 @@ This is broken into its own module in case the behaviour needs to be replicated
10
10
(i.e. [ CSS Modules Values] ( https://github.com/css-modules/postcss-modules-values ) )
11
11
12
12
``` js
13
- import { replaceSymbols , replaceValueSymbols } from " icss-utils"
14
- replaceSymbols (css, replacements)
15
- replaceValueSymbols (string, replacements)
13
+ import { replaceSymbols , replaceValueSymbols } from " icss-utils" ;
14
+
15
+ replaceSymbols (css, replacements);
16
+ replaceValueSymbols (string, replacements);
16
17
```
17
18
18
19
Where:
@@ -30,24 +31,28 @@ A symbol is a string of alphanumeric, `-` or `_` characters. A replacement can b
30
31
Extracts and remove (if removeRules is equal true) from PostCSS tree ` :import ` and ` :export ` statements.
31
32
32
33
``` js
33
- import postcss from ' postcss' ;
34
- import { extractICSS } from ' icss-utils'
34
+ import postcss from " postcss" ;
35
+ import { extractICSS } from " icss-utils" ;
35
36
36
37
const css = postcss .parse (`
37
- :import(colors) {
38
+ :import(" colors.css" screen and (orientation:landscape) ) {
38
39
a: b;
39
40
}
40
41
:export {
41
42
c: d;
42
43
}
43
- ` )
44
+ ` );
44
45
45
- extractICSS (css)
46
+ extractICSS (css);
46
47
/*
47
48
{
48
49
icssImports: {
49
- colors: {
50
- a: 'b'
50
+ '"colors.css" screen and (orientation:landscape)': {
51
+ path: "colors.css",
52
+ extra: "screen and (orientation:landscape)",
53
+ tokens: {
54
+ a: 'b'
55
+ }
51
56
}
52
57
},
53
58
icssExports: {
@@ -62,18 +67,22 @@ extractICSS(css)
62
67
Converts icss imports and exports definitions to postcss ast
63
68
64
69
``` js
65
- createICSSRules ({
66
- colors: {
67
- a: ' b'
70
+ createICSSRules (
71
+ {
72
+ ' "colors.css"' : {
73
+ a: " b"
74
+ }
75
+ },
76
+ {
77
+ c: " d"
68
78
}
69
- }, {
70
- c: ' d'
71
- })
79
+ );
72
80
```
73
81
74
82
## License
75
83
76
84
ISC
77
85
78
86
---
79
- Glen Maddern and Bogdan Chadkin, 2015.
87
+
88
+ Glen Maddern, Bogdan Chadkin and Evilebottnawi 2015-present.
0 commit comments