Skip to content

Instantly share code, notes, and snippets.

View megasanjay's full-sized avatar
😐

Sanjay Soundarajan megasanjay

😐
View GitHub Profile
@megasanjay
megasanjay / naive-ui.ts
Created September 25, 2024 20:26 — forked from BarishNamazov/naive-ui.ts
Naive UI plugin for Nuxt that adds styles to the head tag. Removes style load lag. Use with caution as it increases rendered HTML size.
import { setup } from "@css-render/vue3-ssr";
import { defineNuxtPlugin, type NuxtSSRContext } from "#app";
export default defineNuxtPlugin((nuxtApp) => {
if (process.server) {
const { collect } = setup(nuxtApp.vueApp);
const originalRenderMeta = nuxtApp.ssrContext?.renderMeta;
nuxtApp.ssrContext = nuxtApp.ssrContext || ({} as NuxtSSRContext);
nuxtApp.ssrContext.renderMeta = () => {