Important
This repository is now deprecated in favor of unplugin-svg-transformer
, the successor of nuxt-svg-transformer
. Please consider to use unplugin-svg-transformer
instead.
A Nuxt 3 module to manage SVG as icons, transform SVG to inject dynamically into Vue component, type included.
- Nuxt 3 support
- 🔎 Vue component ready with
SvgIcon
- 🔥 Hot reloading when SVG updated
- 🤙🏻 Reactivity option
- 🗂 Seperated index SVG files
- 📦 No import needed, SVG directly injected
- 🎨 Options to add or clear
style
andclass
global attributes - 🦾 SVG typed, validate by
name
prop (typescript
required)
Breaking changes:
- Cache directory is now hidden by default
- Works with
unplugin
- Options:
fallback
option is nowstring
componentName
removed (SvgIcon
is now the default for Vue/Nuxt/React components)assetsDir
is nowsvgDir
and should contains only your SVG fileslazy
removedlog
is nowwarning
display
removed, usesvg
groupinlineStyleDefault
insteadreactive
removed, usereactive
prop on Vue/Nuxt component instead (React component is always reactive)- New option
svg
groupclassDefault
,clearClass
,clearSize
,clearStyle
,sizeInherit
,inlineStyleDefault
,title
,currentColor
styleDefault
is nowinlineStyle
intosvg
groupinlineStyle
is nowinlineStyleDefault
classDefault
andinlineStyleDefault
are nowstring[]
This documentation offer to install unplugin-svg-transformer
instead nuxt-svg-transformer
(deprecated), you can use the same options.
npm i unplugin-svg-transformer --save-dev
# or
yarn add unplugin-svg-transformer --dev
# or
pnpm add unplugin-svg-transformer -D
Add it to nuxt.config.ts
:
export default defineNuxtConfig({
modules: [
"unplugin-svg-transformer/nuxt", // https://github.com/kiwilan/unplugin-svg-transformer
],
svgTransformer: {
// Options
},
});
See documentation.
MIT - Made with 💚