You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the option is switched on classes exported as variables. Be sure you using `camelCase` option of [css-loader](https://github.com/webpack-contrib/css-loader) to avoid invalid name of variables.
37
+
### `banner`
38
+
Adds a "banner" prefix to each generated file.
39
+
40
+
## css-loader
41
+
As loader uses output of `css-loader`, generated typings depends on it's options.
40
42
43
+
When [exportOnlyLocals](https://github.com/webpack-contrib/css-loader#exportonlylocals) is on, class names exported as variables:
41
44
```ts
42
-
// This file is generated automatically.
43
45
exportconst button:string;
44
46
exportconst buttonActive:string;
45
47
```
48
+
Be sure you using [camelCase](https://github.com/webpack-contrib/css-loader#camelcase) to avoid invalid name of variables.
46
49
47
-
When option is off:
50
+
When option is off, will be generated following typings:
48
51
```ts
49
-
// This file is generated automatically.
50
52
exportinterfaceI_buttonScss {
51
-
'button':string
52
-
'buttonActive':string
53
+
'paButton':string;
54
+
'paButtonActive':string;
53
55
}
54
-
declareconst styles:I_buttonScss;
55
-
exportdefaultstyles;
56
+
exportconst locals:I_buttonScss;
56
57
```
57
58
58
-
### `banner`
59
-
Adds a "banner" prefix to each generated file.
60
-
61
59
## Usage in Typescript
60
+
61
+
With `exportOnlyLocals`:
62
+
```ts
63
+
import*asclassesfrom'./_button.scss';
64
+
```
65
+
66
+
Without:
62
67
```ts
63
-
import*asstylesfrom'./_button.scss';
68
+
import{ localsasclasses }from'./_button.scss';
64
69
```
65
70
66
71
To avoid errors about the absent module, you need to determine this:
@@ -73,7 +78,7 @@ declare module '*.scss' {
73
78
export=classes;
74
79
}
75
80
```
76
-
When you add new classname Typescript compiler may not find the generated variable so you need to compile twice your files.
81
+
When you add new class name, Typescript compiler may not find the generated variable so you need to compile twice your files.
0 commit comments