14
14
## Features
15
15
16
16
* Full support of SVGs as components. Import them like your Vue SFCs
17
+ * Use Vue bindings as you'd do it with normal components
17
18
* Built on top of [ svg-to-vue-component] ( https://github.com/egoist/svg-to-vue-component )
18
19
* Nuxt 2 (and only Nuxt 2) support
19
20
* Fully tested!
@@ -31,7 +32,7 @@ A [live demo](https://zxr9l743l3.sse.codesandbox.io/) is available through the [
31
32
{
32
33
modules: [
33
34
' nuxt-svg-loader' ,
34
- ],
35
+ ]
35
36
}
36
37
```
37
38
@@ -73,9 +74,11 @@ export default {
73
74
74
75
## Configuration
75
76
76
- The plugin will work seamlessly out of the box. If you are in need of
77
- configuring the loader options (eg for [ id prefixing] ( https://vue-svg-loader.js.org/faq.html#how-to-use-both-inline-and-external-svgs ) ),
78
- you can do that:
77
+ The plugin will work seamlessly out of the box.
78
+ It will also include SVGO defaults to avoid collisions between your optimized SVG files!
79
+
80
+ If you want to configure the underlying loader (or SVGO), you can do that easily as well.
81
+ (All options available [ here] ( https://github.com/egoist/svg-to-vue-component#loader-options ) )
79
82
80
83
``` js
81
84
// file: nuxt.config.js
@@ -84,9 +87,27 @@ export default {
84
87
// ...
85
88
// Your loader options as svgLoader object
86
89
svgLoader: {
87
- svgo : {
90
+ svgoConfig : {
88
91
plugins: [
89
- { prefixIds: true },
92
+ { prefixIds: false }, // Disables prefixing for SVG IDs
93
+ ]
94
+ }
95
+ }
96
+ }
97
+ ```
98
+
99
+ ## Migrating from 0.x
100
+
101
+ 1 . Update the deps (of course!)
102
+ 2 . Rename ` svgo ` to ` svgoConfig `
103
+ 3 . If you used id prefixing manually before, you can delete the config:
104
+
105
+ ``` js
106
+ export default {
107
+ svgLoader: {
108
+ svgo: { // Rename to svgoConfig
109
+ plugins: [
110
+ { prefixIds: true } // Delete that line (or the whole svgLoader object if you don't have any other configurations)
90
111
]
91
112
}
92
113
}
0 commit comments