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
Every icon is exported with its original name in PascalCase. So `coffee` becomes `Coffee`,
23
+
`cloud-print-outline` is exported as `CloudPrintOutline` and so on.
23
24
24
-
Every icon is exported with its original name in PascalCase, plus _Icon_. So `coffee` becomes `CoffeeIcon`,
25
-
`cloud-print-outline` is exported as `CloudPrintOutlineIcon` and so on.
25
+
### With tree-shaking
26
+
If your environment supports tree-shaking and you are sure that it works fine in your setup, you can simply import the icons as follows:
26
27
27
28
```js
28
-
import { CoffeeIcon } from'mdi-material-ui'
29
+
import { Coffee, Food } from'mdi-material-ui'
30
+
```
29
31
30
-
// ...
32
+
### Without tree-shaking
33
+
If your environment doesn't support tree-shaking, you should only import the icons that you actually need in order to ensure that you don't end up bundling _all_ icons.
34
+
35
+
```js
36
+
importCoffeefrom'mdi-material-ui/Coffee'
37
+
importFoodfrom'mdi-material-ui/Food'
38
+
```
31
39
32
-
render() {
33
-
return (
34
-
<div>
35
-
Enjoy your coffee!<CoffeeIcon />
36
-
</div>
37
-
)
40
+
If you think that this is far too verbose (I agree!), consider using [babel-plugin-direct-import](https://github.com/umidbekkarimov/babel-plugin-direct-import). Install it and adjust your `.babelrc` by adding the following snippet to the plugins section:
41
+
42
+
```js
43
+
{
44
+
// ...
45
+
plugins: [
46
+
// ...
47
+
["direct-import", [{
48
+
name:"mdi-material-ui",
49
+
indexFile:"mdi-material-ui/index.es"
50
+
}]]
51
+
]
38
52
}
39
53
```
40
54
41
55
## Related projects
42
56
Feel more like using a webfont instead of inline svg? We've [got your back][materialdesign-webfont-material-ui]!
43
57
44
58
## License
45
-
46
59
The scripts included in this repository are licensed under the WTFPL.
47
60
The icons are licensed under the MIT license (see [Material Design Icons](https://github.com/Templarian/MaterialDesign-SVG) and the [NOTICE][] file).
0 commit comments