@@ -45,56 +45,56 @@ Spectrum CSS components have build output that uses CSS custom properties to cha
45
45
``` html
46
46
<!-- Include global variables first -->
47
47
<link
48
- rel =" stylesheet"
49
- href =" node_modules/@spectrum-css/vars/dist/spectrum-global.css"
48
+ rel =" stylesheet"
49
+ href =" node_modules/@spectrum-css/vars/dist/spectrum-global.css"
50
50
/>
51
51
52
52
<!-- Include only the scales your application needs -->
53
53
<link
54
- rel =" stylesheet"
55
- href =" node_modules/@spectrum-css/vars/dist/spectrum-medium.css"
54
+ rel =" stylesheet"
55
+ href =" node_modules/@spectrum-css/vars/dist/spectrum-medium.css"
56
56
/>
57
57
<link
58
- rel =" stylesheet"
59
- href =" node_modules/@spectrum-css/vars/dist/spectrum-large.css"
58
+ rel =" stylesheet"
59
+ href =" node_modules/@spectrum-css/vars/dist/spectrum-large.css"
60
60
/>
61
61
62
62
<!-- Include only the colorstops your application needs -->
63
63
<link
64
- rel =" stylesheet"
65
- href =" node_modules/@spectrum-css/vars/dist/spectrum-light.css"
64
+ rel =" stylesheet"
65
+ href =" node_modules/@spectrum-css/vars/dist/spectrum-light.css"
66
66
/>
67
67
<link
68
- rel =" stylesheet"
69
- href =" node_modules/@spectrum-css/vars/dist/spectrum-dark.css"
68
+ rel =" stylesheet"
69
+ href =" node_modules/@spectrum-css/vars/dist/spectrum-dark.css"
70
70
/>
71
71
<link
72
- rel =" stylesheet"
73
- href =" node_modules/@spectrum-css/vars/dist/spectrum-darkest.css"
72
+ rel =" stylesheet"
73
+ href =" node_modules/@spectrum-css/vars/dist/spectrum-darkest.css"
74
74
/>
75
75
76
76
<!-- Include tokens -->
77
77
<link
78
- rel =" stylesheet"
79
- href =" node_modules/@spectrum-css/tokens/dist/index.css"
78
+ rel =" stylesheet"
79
+ href =" node_modules/@spectrum-css/tokens/dist/index.css"
80
80
/>
81
81
82
- <!-- Include index-vars .css for all components you need -->
82
+ <!-- Include index.css for all components you need -->
83
83
<link
84
- rel =" stylesheet"
85
- href =" node_modules/@spectrum-css/page/dist/index-vars .css"
84
+ rel =" stylesheet"
85
+ href =" node_modules/@spectrum-css/page/dist/index.css"
86
86
/>
87
87
<link
88
- rel =" stylesheet"
89
- href =" node_modules/@spectrum-css/typography/dist/index-vars .css"
88
+ rel =" stylesheet"
89
+ href =" node_modules/@spectrum-css/typography/dist/index.css"
90
90
/>
91
91
<link
92
- rel =" stylesheet"
93
- href =" node_modules/@spectrum-css/icon/dist/index-vars .css"
92
+ rel =" stylesheet"
93
+ href =" node_modules/@spectrum-css/icon/dist/index.css"
94
94
/>
95
95
<link
96
- rel =" stylesheet"
97
- href =" node_modules/@spectrum-css/button/dist/index-vars .css"
96
+ rel =" stylesheet"
97
+ href =" node_modules/@spectrum-css/button/dist/index.css"
98
98
/>
99
99
```
100
100
@@ -108,27 +108,27 @@ To switch to Express, load vars from `@spectrum-css/expressvars` instead of `@sp
108
108
109
109
``` html
110
110
<html class =" spectrum spectrum--medium spectrum--light spectrum--express" >
111
- <head >
112
- <!-- Include only the scales your application needs -->
113
- <link
114
- rel =" stylesheet"
115
- href =" node_modules/@spectrum-css/expressvars/dist/spectrum-medium.css"
116
- />
117
- <link
118
- rel =" stylesheet"
119
- href =" node_modules/@spectrum-css/expressvars/dist/spectrum-large.css"
120
- />
121
-
122
- <!-- Include only the colorstops your application needs -->
123
- <link
124
- rel =" stylesheet"
125
- href =" node_modules/@spectrum-css/expressvars/dist/spectrum-light.css"
126
- />
127
- <link
128
- rel =" stylesheet"
129
- href =" node_modules/@spectrum-css/expressvars/dist/spectrum-dark.css"
130
- />
131
- </head >
111
+ <head >
112
+ <!-- Include only the scales your application needs -->
113
+ <link
114
+ rel =" stylesheet"
115
+ href =" node_modules/@spectrum-css/expressvars/dist/spectrum-medium.css"
116
+ />
117
+ <link
118
+ rel =" stylesheet"
119
+ href =" node_modules/@spectrum-css/expressvars/dist/spectrum-large.css"
120
+ />
121
+
122
+ <!-- Include only the colorstops your application needs -->
123
+ <link
124
+ rel =" stylesheet"
125
+ href =" node_modules/@spectrum-css/expressvars/dist/spectrum-light.css"
126
+ />
127
+ <link
128
+ rel =" stylesheet"
129
+ href =" node_modules/@spectrum-css/expressvars/dist/spectrum-dark.css"
130
+ />
131
+ </head >
132
132
</html >
133
133
```
134
134
@@ -169,7 +169,7 @@ These icons are released within the [`@adobe/spectrum-css-workflow-icons`](https
169
169
170
170
``` js
171
171
loadIcons (
172
- " node_modules/@adobe/spectrum-css-workflow-icons/dist/spectrum-icons.svg"
172
+ " node_modules/@adobe/spectrum-css-workflow-icons/dist/spectrum-icons.svg"
173
173
);
174
174
```
175
175
@@ -195,7 +195,7 @@ For Arabic, a right-to-left language:
195
195
196
196
### Variable fallbacks
197
197
198
- Each component has a ` dist/vars.css ` file that contains declarations for each component-level variable used by the component. The CSS in ` dist/index-vars .css ` references these variables, but has fallbacks for the global variables or hardcoded value that that the component-level variables resolve to.
198
+ Each component has a ` dist/vars.css ` file that contains declarations for each component-level variable used by the component. The CSS in ` dist/index.css ` references these variables, but has fallbacks for the global variables or hardcoded value that that the component-level variables resolve to.
199
199
200
200
As such, ** you do not need to include ` dist/vars.css ` ** unless:
201
201
@@ -212,12 +212,12 @@ Spectrum CSS is designed to be as flexible as possible, and as such, leaves room
212
212
213
213
``` json
214
214
{
215
- "name" : " my-project" ,
216
- "devDependencies" : {
217
- "@spectrum-css/button" : " ^3.0.0" ,
218
- "@spectrum-css/page" : " ^3.0.0" ,
219
- "@spectrum-css/vars" : " ^3.0.0"
220
- }
215
+ "name" : " my-project" ,
216
+ "devDependencies" : {
217
+ "@spectrum-css/button" : " ^3.0.0" ,
218
+ "@spectrum-css/page" : " ^3.0.0" ,
219
+ "@spectrum-css/vars" : " ^3.0.0"
220
+ }
221
221
}
222
222
```
223
223
@@ -227,8 +227,8 @@ You've created an `index.css` that imports a few components, a scale, and a colo
227
227
@import " node_modules/@spectrum-css/vars/dist/spectrum-global.css" ;
228
228
@import " node_modules/@spectrum-css/vars/dist/spectrum-medium.css" ;
229
229
@import " node_modules/@spectrum-css/vars/dist/spectrum-light.css" ;
230
- @import " node_modules/@spectrum-css/page/dist/index-vars .css" ;
231
- @import " node_modules/@spectrum-css/button/dist/index-vars .css" ;
230
+ @import " node_modules/@spectrum-css/page/dist/index.css" ;
231
+ @import " node_modules/@spectrum-css/button/dist/index.css" ;
232
232
```
233
233
234
234
To build an more optimized bundle, you can employ a few simple PostCSS plugins. First, install them:
@@ -243,12 +243,12 @@ Next, create a `postcss.config.js`:
243
243
244
244
``` js
245
245
module .exports = {
246
- plugins: [
247
- require (" postcss-import" ),
248
- require (" postcss-varfallback" ),
249
- require (" postcss-dropunusedvars" ),
250
- require (" cssnano" ),
251
- ],
246
+ plugins: [
247
+ require (" postcss-import" ),
248
+ require (" postcss-varfallback" ),
249
+ require (" postcss-dropunusedvars" ),
250
+ require (" cssnano" ),
251
+ ],
252
252
};
253
253
```
254
254
@@ -278,34 +278,34 @@ Then, add something like this to your `postcss.config.js`:
278
278
279
279
``` js
280
280
module .exports = {
281
- plugins: [
282
- require (" postcss-transformselectors" )({
283
- replace: [
284
- { search: " .spectrum-Heading--sizeXXL" , replace: " h1" },
285
- { search: " .spectrum-Heading--sizeXL" , replace: " h2" },
286
- { search: " .spectrum-Heading--sizeL" , replace: " h3" },
287
- ],
288
- transform : (selector ) => {
289
- if (selector .startsWith (" .spectrum-Heading" )) {
290
- // Operate on each selector in a selector list
291
- return selector
292
- .split (" ," )
293
- .map ((selectorPart ) => {
294
- // Create separate selectors for each reference to .spectrum-Heading
295
- return [" h1" , " h2" , " h3" ]
296
- .map ((h ) => {
297
- return selectorPart .replace (" .spectrum-Heading" , h);
298
- })
299
- .join (" ," );
300
- })
301
- .join (" ," );
302
- }
303
-
304
- // Don't mess with things that don't have .spectrum-Heading in them
305
- return selector;
306
- },
307
- }),
308
- ],
281
+ plugins: [
282
+ require (" postcss-transformselectors" )({
283
+ replace: [
284
+ { search: " .spectrum-Heading--sizeXXL" , replace: " h1" },
285
+ { search: " .spectrum-Heading--sizeXL" , replace: " h2" },
286
+ { search: " .spectrum-Heading--sizeL" , replace: " h3" },
287
+ ],
288
+ transform : (selector ) => {
289
+ if (selector .startsWith (" .spectrum-Heading" )) {
290
+ // Operate on each selector in a selector list
291
+ return selector
292
+ .split (" ," )
293
+ .map ((selectorPart ) => {
294
+ // Create separate selectors for each reference to .spectrum-Heading
295
+ return [" h1" , " h2" , " h3" ]
296
+ .map ((h ) => {
297
+ return selectorPart .replace (" .spectrum-Heading" , h);
298
+ })
299
+ .join (" ," );
300
+ })
301
+ .join (" ," );
302
+ }
303
+
304
+ // Don't mess with things that don't have .spectrum-Heading in them
305
+ return selector;
306
+ },
307
+ }),
308
+ ],
309
309
};
310
310
```
311
311
0 commit comments