Skip to content

Commit

Permalink
feat: auto import components
Browse files Browse the repository at this point in the history
  • Loading branch information
logustra committed Mar 11, 2021
1 parent 0ec4cde commit 082a3b6
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"tailwindcss": "^2.0.3",
"typescript": "^4.2.3",
"vite": "^2.0.5",
"vite-plugin-components": "^0.8.0",
"vite-plugin-icons": "^0.3.2",
"vue": "^3.0.7",
"vue-eslint-parser": "^7.6.0",
Expand Down
40 changes: 40 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 1 addition & 7 deletions src/modules/Home/views/home.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
Bismillah, Hello Vue
<IconAccessibility />
<CilGlobeAlt />
</div>
</template>

Expand All @@ -14,15 +14,9 @@ import { useStore } from 'vuex'
import { SET_TITLE } from '@/stores/Common/commonTypes'
import IconAccessibility from '/@vite-icons/cil/globe-alt'
export default defineComponent({
name: 'Home',
components: {
IconAccessibility
},
setup () {
const store = useStore()
const common = store.getters.common
Expand Down
17 changes: 16 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import { resolve } from 'path'
import { defineConfig } from 'vite'
import Vue from '@vitejs/plugin-vue'
import ViteIcons from 'vite-plugin-icons'
import ViteComponents from 'vite-plugin-components'
import ViteIcons, { ViteIconsResolver } from 'vite-plugin-icons'

export default defineConfig({
plugins: [
Vue(),

/**
* NOTE:
* auto import components
*/
ViteComponents({
customComponentResolvers: [
ViteIconsResolver({
componentPrefix: '',
enabledCollections: ['cil']
}),
],
}),

ViteIcons(),
],

Expand Down

0 comments on commit 082a3b6

Please sign in to comment.