From a569e7427b7688887452ef85e2033b287fcd79ae Mon Sep 17 00:00:00 2001 From: Yizack Rangel Date: Sun, 21 May 2023 19:32:28 +0200 Subject: [PATCH] feat: twemoji component for nuxt - Nuxt 3 ready - Get emoji by character - Get emoji by codepoint - SVG rendering by default - Insert as PNG image fetched from the jsdelivr CDN --- src/module.ts | 21 +++++++++ src/runtime/components/Twemoji.vue | 74 ++++++++++++++++++++++++++++++ 2 files changed, 95 insertions(+) create mode 100644 src/module.ts create mode 100644 src/runtime/components/Twemoji.vue diff --git a/src/module.ts b/src/module.ts new file mode 100644 index 0000000..d1d9ca5 --- /dev/null +++ b/src/module.ts @@ -0,0 +1,21 @@ +import { defineNuxtModule, createResolver, addComponent } from '@nuxt/kit' + +export interface ModuleOptions {} + +export default defineNuxtModule({ + meta: { + name: 'nuxt-twemoji', + configKey: 'nuxtTwemoji', + compatibility: { + nuxt: '^3.0.0' + } + }, + setup () { + const { resolve } = createResolver(import.meta.url) + addComponent({ + name: 'Twemoji', + global: true, + filePath: resolve('./runtime/components/Twemoji.vue') + }) + } +}) diff --git a/src/runtime/components/Twemoji.vue b/src/runtime/components/Twemoji.vue new file mode 100644 index 0000000..62eefaf --- /dev/null +++ b/src/runtime/components/Twemoji.vue @@ -0,0 +1,74 @@ + + + + + +