Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit dea5d03

Browse files
authored
Merge pull request #42 from shopware/add-vite-example-to-readme
Add vite example to readme
2 parents e4d2400 + d20ed87 commit dea5d03

File tree

1 file changed

+34
-3
lines changed

1 file changed

+34
-3
lines changed

README.md

Lines changed: 34 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ $ yarn -v
2626
- [Table of contents](#table-of-contents)
2727
- [Installation](#installation)
2828
- [Usage](#usage)
29+
- [Vite example](#example)
2930
- [Built With](#built-with)
3031
- [Figma library](#figma-library)
3132
- [License](#license)
@@ -70,9 +71,7 @@ import wallet from '@shopware-ag/meteor-icon-kit/icons/regular/wallet.svg';
7071
Take this pseudo html:
7172
```html
7273
<span class="icon-example">
73-
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24">
74-
<!--- ... -->
75-
</svg>
74+
<wallet />
7675
</span>
7776
```
7877

@@ -93,6 +92,38 @@ By defining the following class structure in `CSS` you can change the color of t
9392
}
9493
```
9594

95+
## Example
96+
97+
Following is an example for a Vue3 project using Vite as a bundler.
98+
We are using the `vite-svg-loader` to load the svg files.
99+
100+
In your `vite.config.js` add the following:
101+
```js
102+
//...
103+
import svgLoader from 'vite-svg-loader';
104+
105+
export default {
106+
plugins: [
107+
//...
108+
svgLoader()
109+
],
110+
};
111+
112+
```
113+
114+
This way you can import your svg files as components:
115+
```vue
116+
<template>
117+
<ActivityIcon />
118+
</template>
119+
120+
<script setup>
121+
import ActivityIcon from '@shopware-ag/meteor-icon-kit/icons/regular/activity.svg';
122+
</script>
123+
```
124+
125+
You can find this example as a CodeSandbox template [here](https://codesandbox.io/p/sandbox/meteor-icon-kit-example-revdlr).
126+
96127
## Built With
97128

98129
* Typescript

0 commit comments

Comments
 (0)