From 5b0dc9b92203daaac5c12792c4813283665134ff Mon Sep 17 00:00:00 2001 From: Damian Stasik Date: Sun, 14 Jun 2020 20:22:57 +0200 Subject: [PATCH] Change the way of importing SVGs as Vue components Previously to use SVG file as a component you would need to add `?component` to the path of the imported SVG file. That caused a lot of issues for both build process and tests, as neither Rollup nor Jest supports query string in the file path. --- README.md | 10 +++++----- index.js | 46 ++++++++++++++++++++++++++++++---------------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index e7ca5d0..ec93899 100644 --- a/README.md +++ b/README.md @@ -13,19 +13,19 @@ Vite is currently in an experimental state which means this plugin will change a #### Currently supported Vite version: -

0.20.4

+

0.20.8

### Install ```bash -yarn add --dev vite-plugin-svg @vue/compiler-dom +yarn add --dev vite-plugin-svg -npm i -D vite-plugin-svg @vue/compiler-dom +npm i -D vite-plugin-svg ``` ### Usage -To use SVG file as a Vue component you need to append `?component` query string to the path of your file. +Starting from `v0.4.0` to use SVG file as a component, just import `VueComponent` from the path of the file. This gives you more control over how a particular SVG file should be loaded and processed: ```js @@ -48,7 +48,7 @@ img.src = myIconUrl;