vite-plugin-vue2-svg
load SVG files as Vue components, for Vue2.x only.
345,822
19
| Install | |
|---|---|
npm install vite-plugin-vue2-svg |
|
| Latest Version: | 0.4.0 |
| Vue: | 2 |
| License: | MIT |
| Last Updated: | Nov 4, 2023 |
| Links: | GitHub · npm |
Maintainer: pakholeung
vite-plugin-vue2-svg
load SVG files as Vue components, for Vue2.x only.
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
Related Packages
unplugin-svg-vue-component
Use svg as vue components with support for both vue2.7 and vue3.x
953,115
3
vite-plugin-git-revision
Vite plugin that generates VERSION and COMMITHASH files during build based on a...
21,961
11
Version History
| Version | Released | License |
|---|---|---|
| 0.4.0 | MIT | |
| 0.3.0 | MIT | |
| 0.2.2 | MIT | |
| 0.2.1 | MIT | |
| 0.1.8 | MIT | |
| 0.1.7 | MIT | |
| 0.1.6 | MIT | |
| 0.1.5 | MIT | |
| 0.1.4 | MIT | |
| 0.1.3 | ISC | |
| 0.1.2 | ISC | |
| 0.1.1 | ISC |
