Files
Benjamin Canac f6ae153428 feat: import @nuxt/ui-pro components (#4675)
Co-authored-by: Hugo Richard <hugo.richard@epitech.eu>
2025-08-14 21:28:57 +02:00

36 lines
852 B
TypeScript

export default defineNuxtPlugin({
enforce: 'post',
setup() {
const { framework } = useSharedData()
if (import.meta.client) {
useHead({
htmlAttrs: {
'data-framework': framework
}
})
}
if (import.meta.server) {
useHead({
script: [{
innerHTML: `
function getCookie(name) {
var value = '; ' + window.document.cookie;
var parts = value.split('; ' + name + '=');
if (parts.length === 2) {
return parts.pop()?.split(';').shift();
}
}
var f = getCookie('nuxt-ui-framework');
document.documentElement.setAttribute('data-framework', f || 'nuxt');
`.replace(/\s+/g, ' '),
type: 'text/javascript',
tagPriority: -1
}]
})
}
}
})