Skip to content
Permalink
Browse files
fix(nuxt): use nuxt.options.css instead of plugin
  • Loading branch information
antfu committed Nov 2, 2022
1 parent 2138013 commit 77d912bbdfcf5ae72786aca3dcf85ba71c31349d
Showing 1 changed file with 6 additions and 13 deletions.
@@ -1,6 +1,6 @@
import { dirname, resolve } from 'path'
import { fileURLToPath } from 'url'
import { addComponentsDir, addPluginTemplate, defineNuxtModule, extendWebpackConfig } from '@nuxt/kit'
import { addComponentsDir, defineNuxtModule, extendWebpackConfig } from '@nuxt/kit'
import WebpackPlugin from '@unocss/webpack'
import VitePlugin from '@unocss/vite'
import { resolveOptions } from './options'
@@ -32,18 +32,11 @@ export default defineNuxtModule<UnocssNuxtOptions>({
resolveOptions(options)

if (options.autoImport) {
addPluginTemplate({
filename: 'unocss.mjs',
getContents: () => {
const lines = [
'import \'uno.css\'',
'export default defineNuxtPlugin(() => {})',
]
if (options.preflight)
lines.unshift('import \'@unocss/reset/tailwind.css\'')
return lines.join('\n')
},
})
nuxt.options.css ||= []
nuxt.options.css.push('uno.css')

if (options.preflight)
nuxt.options.css.unshift('@unocss/reset/tailwind.css')
}

if (options.components) {

0 comments on commit 77d912b

Please sign in to comment.