Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(nuxt): use nuxt.options.css instead of plugin
  • Loading branch information
antfu committed Nov 2, 2022
1 parent 2138013 commit 77d912b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions packages/nuxt/src/index.ts
@@ -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'
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 77d912b

Please sign in to comment.