Skip to content

pakholeung37/vite-plugin-vue2-svg

Repository files navigation

vite-plugin-vue2-svg

load SVG files as Vue components, for Vue2.x only.

NPM

Install

yarn add vite-plugin-vue2-svg
# or
npm install vite-plugin-vue2-svg

Usage

// vite.config.ts
import { defineConfig } from "vite";
import { createVuePlugin } from "vite-plugin-vue2"; // vue2 plugin
import { createSvgPlugin } from "vite-plugin-vue2-svg";

export default defineConfig({
  plugins: [createVuePlugin(), createSvgPlugin()],
});
<!-- App.vue -->
<template>
  <Icon />
</template>
<script>
import Icon from "./icon.svg";

export default {
  components: {
    Icon,
  },
};
</script>

If you want disabled this plugin for specific file, just add ?raw when you import.

import Icon from "./icon.svg?raw"; // svg file import without transform

Options

createSvgPlugin({
  svgoConfig: SVGO.Options, // check https://github.com/svg/svgo
});

License

MIT

About

load SVG files as Vue components, for Vue2.x only.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy