Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update vite doc #204

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 42 additions & 2 deletions packages/vite-plugin-svgicon/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,37 @@
# vite plugin for @yzfe/svgicon

## Install

### vue2.x
```bash
yarn add @yzfe/svgicon
yarn add vite-plugin-svgicon --dev
```

### vue3.x
```bash
yarn add @yzfe/svgicon @yzfe/vue3-svgicon
yarn add vite-plugin-svgicon --dev
```

## Setup
```ts
```ts vue2.x
// vite.config.js
import { defineConfig } from 'vite'
import {createVuePlugin as vue} from 'vite-plugin-vue2'
import svgicon from 'vite-plugin-svgicon'

export default defineConfig({
plugins: [
vue(),
svgicon({
include: ['**/svg-icon/**/*.svg']
})
]
})
```

```ts vue3.x
// vite.config.js
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
Expand All @@ -24,7 +48,22 @@ export default defineConfig({
```

```ts
// main.ts
// main.ts vue2.x
import vue from 'vue'
import App from './App'
import { VueSvgIconPlugin } from '@yzfe/vue-svgicon'
import '@yzfe/svgicon/lib/svgicon.css'

Vue.component("icon",VueSvgIcon);

new Vue({
render:(h)=>(App),
}).$mount("#app")
```


```ts
// main.ts vue3.x
import { createApp } from 'vue'
import App from './App'
import { VueSvgIconPlugin } from '@yzfe/vue3-svgicon'
Expand All @@ -38,6 +77,7 @@ createApp(App)
.mount('#app')
```


```html
<!-- App.vue -->
<template>
Expand Down