Nuxt Svgo Loader

Nuxt module to load SVG files as Vue components, using SVGO for optimization.

Features

  • ? Load SVG files as Vue components.
  • ? Optimize SVGs using SVGO.
  • ?️ Seamless integration with Nuxt DevTools.

Installation

Install and add nuxt-svgo-loader to your nuxt.config.

# Whichever matches your package manager
pnpm add -D nuxt-svgo-loader
npm install -D nuxt-svgo-loader
yarn add -D nuxt-svgo-loader

export default defineNuxtConfig({
  modules: ['nuxt-svgo-loader'],
  svgoLoader: {
    // Options here will be passed to `vite-svg-loader`
  }
})

Note

Since nuxt-svgo-loader is a Nuxt module based on vite-svg-loader, the configuration for svgoLoader remains identical to that of vite-svg-loader. You can refer to the documentation of vite-svg-loader for the available options here.

DevTools

This module adds a new tab to the Nuxt DevTools, which allows you to inspect the SVG files.

DevTools

License

MIT License © 2023-PRESENT Alex Liu

GitHub

View Github