From cd7b9bf03ddd0efac2112db99e09d189d9429acd Mon Sep 17 00:00:00 2001 From: venashial Date: Tue, 31 Aug 2021 11:58:13 -0700 Subject: [PATCH] Support Nuxt auto-importing Vue components (#390) * Add support for nuxt component auto importing * Add documentation for using with nuxt components --- packages/lucide-vue/README.md | 18 ++++++++++++++++++ packages/lucide-vue/nuxt.js | 12 ++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 packages/lucide-vue/nuxt.js diff --git a/packages/lucide-vue/README.md b/packages/lucide-vue/README.md index 7c5153e..1727f14 100644 --- a/packages/lucide-vue/README.md +++ b/packages/lucide-vue/README.md @@ -105,3 +105,21 @@ export default { ``` + +## Use with [@nuxt/components](https://github.com/nuxt/components#readme) + +### Setup +In your `nuxt.config.js`, add `lucide-vue/nuxt` to your `buildModules` +```js +export default { + buildModules: ['lucide-vue/nuxt'] +} +``` + +### How to use +Icon components are prefixed with `Icon`. Use icon components without importing them. + +### Example +```html + +``` \ No newline at end of file diff --git a/packages/lucide-vue/nuxt.js b/packages/lucide-vue/nuxt.js new file mode 100644 index 0000000..33e6f54 --- /dev/null +++ b/packages/lucide-vue/nuxt.js @@ -0,0 +1,12 @@ +import { join } from 'path' + +export default function () { + + this.nuxt.hook('components:dirs', dirs => { + dirs.push({ + path: join(__dirname, 'dist', 'esm', 'icons'), + prefix: 'Icon', + ignore: ['**/index.js'] + }) + }) +} \ No newline at end of file