Skip to content

Commit

Permalink
fix(nuxt): disable nuxt inlineStyles by default, #3472
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Jan 25, 2024
1 parent fd4cb3e commit 5cee56e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/nuxt/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export default defineNuxtModule<UnocssNuxtOptions>({
autoImport: true,
preflight: false,
components: true,
disableNuxtInlineStyle: true,

// presets
uno: true,
Expand All @@ -40,6 +41,11 @@ export default defineNuxtModule<UnocssNuxtOptions>({
options.mode ??= 'global'
const InjectModes: VitePluginConfig['mode'][] = ['global', 'dist-chunk']

if (options.disableNuxtInlineStyle) {
nuxt.options.features ||= {} as any
nuxt.options.features.inlineStyles = false
}

if (options.injectPosition != null)
console.warn('[unocss/nuxt] options `injectPosition` is temporary removed due to the incompatibility with Nuxt 3.9. We are seeking for better solution. It\'s not effective at this moment.')

Expand Down
7 changes: 7 additions & 0 deletions packages/nuxt/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ export interface UnocssNuxtOptions extends UserConfig {
*/
preflight?: boolean

/**
* Set Nuxt's `features.inlineStyle` to `false` by default to make it work with UnoCSS.
*
* @default true
*/
disableNuxtInlineStyle?: boolean

/**
* Adjust the position of the `uno.css` injection. (Depends on `mode`)
*
Expand Down

0 comments on commit 5cee56e

Please sign in to comment.