{"library":"rollup-plugin-svg-to-vue","title":"rollup-plugin-svg-to-vue","description":"A Rollup plugin that imports SVG files as Vue 3 components. Current stable version is 1.0.0. No release cadence documented. Key differentiator: transforms SVG directly into Vue 3 single-file component format, leveraging @vue/compiler-sfc for compilation. Unlike generic SVG loaders, it produces tree-shakable, scoped-style components. Primarily for use with rollup-plugin-vue in browser or SSR builds. Requires Node >=10, peer dependency on @vue/compiler-sfc.","language":"javascript","status":"active","last_verified":"Mon Apr 27","install":{"commands":["npm install rollup-plugin-svg-to-vue"],"cli":null},"imports":["import svgToVue from 'rollup-plugin-svg-to-vue'","import { svgToVue } from 'rollup-plugin-svg-to-vue'","import MyIcon from './icon.svg'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"// rollup.config.js\nimport svgToVue from 'rollup-plugin-svg-to-vue';\nimport vue from 'rollup-plugin-vue';\n\nexport default {\n  input: 'src/main.js',\n  output: {\n    file: 'dist/bundle.js',\n    format: 'esm'\n  },\n  plugins: [\n    svgToVue({\n      include: '**/*.svg',\n      exclude: ['node_modules/**'],\n      svgo: {\n        plugins: [\n          { removeViewBox: false },\n          { removeTitle: true }\n        ]\n      },\n      sourceMap: true,\n      target: 'browser'\n    }),\n    vue()\n  ]\n};\n\n// MyComponent.vue\n<template>\n  <div>\n    <MyIcon class=\"icon\" />\n  </div>\n</template>\n\n<script>\nimport MyIcon from './icon.svg';\nexport default {\n  components: { MyIcon }\n}\n</script>","lang":"javascript","description":"Demonstrates Rollup configuration using the plugin with optional SVGO settings, and a Vue component importing an SVG file as a component.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}