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
Webpack loader to transform SVGs into Svelte components.
4
+
5
+
It also optimizes your SVGs by running them thru
6
+
[svgo](https://github.com/svg/svgo).
7
+
8
+
## Note
9
+
10
+
This package is not published to NPM at this point in time.
11
+
12
+
## Usage
13
+
14
+
```svelte
15
+
<script>
16
+
import MyIcon from 'assets/my-icon.svg';
17
+
</script>
18
+
19
+
<MyIcon width={42} height={42} />
20
+
```
21
+
22
+
## Setup
23
+
24
+
### `webpack.config.js`
25
+
26
+
```js
27
+
module.exports= {
28
+
//...
29
+
module: {
30
+
rules: [
31
+
{
32
+
test:/\.svg$/,
33
+
use: [
34
+
{
35
+
loader:'svelte-svg-loader',
36
+
options: {
37
+
svgoConfig: {},
38
+
ssr:false,
39
+
},
40
+
},
41
+
],
42
+
},
43
+
],
44
+
},
45
+
};
46
+
```
47
+
48
+
Note: If you are amending an existing Webpack config, make sure to remove the default loader for assets (which includes svgs), or place `svelte-svg-loader` before it in the loaders array.
0 commit comments