Skip to content

Commit

Permalink
feat(tailwindcss): drop integrations config key
Browse files Browse the repository at this point in the history
  • Loading branch information
Tahul committed Jul 12, 2022
1 parent 2668cfc commit 8e568c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 33 deletions.
10 changes: 0 additions & 10 deletions docs/content/4.api/3.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,13 +312,3 @@ Toggles the document-driven mode.
| `globals` | `Object \| Boolean` | A list of globals to be made available globally. |
| `layoutFallbacks` | `string[]` | A list of `globals` key to use to find a layout fallback. |
| `injectPage` | `boolean` | Inject `[...slug].vue` pre-configured page |

## `integrations`

@nuxt/content is built to be used with other [Nuxt modules](https://modules.nuxtjs.org/)!

### `integrations` options

| Option | Type | Description |
| ------------- | :-------: | :------------------------------------------------------------- |
| `tailwindcss` | `Boolean` | Enables the usage of Tailwind classes inside any content file. |
30 changes: 7 additions & 23 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,6 @@ export interface ModuleOptions {
layoutFallbacks: string[]
injectPage: boolean
}
/**
* Integrations config
*/
integrations: {
/**
* Support tailwindcss classes usage in content files.
*/
tailwindcss: boolean
}
}

interface ContentContext extends ModuleOptions {
Expand Down Expand Up @@ -228,10 +219,7 @@ export default defineNuxtModule<ModuleOptions>({
navigation: {
fields: []
},
documentDriven: false,
integrations: {
tailwindcss: true
}
documentDriven: false
},
async setup (options, nuxt) {
const { resolve } = createResolver(import.meta.url)
Expand Down Expand Up @@ -558,16 +546,12 @@ export default defineNuxtModule<ModuleOptions>({
})
})

if (options.integrations) {
// @nuxtjs/tailwindcss support
if (options.integrations.tailwindcss) {
// @ts-ignore - Module might not exist
nuxt.hook('tailwindcss:config', (tailwindConfig) => {
tailwindConfig.content = tailwindConfig.content ?? []
tailwindConfig.content.push(`${nuxt.options.buildDir}/cache/content/parsed/**/*.md`)
})
}
}
// @nuxtjs/tailwindcss support
// @ts-ignore - Module might not exist
nuxt.hook('tailwindcss:config', (tailwindConfig) => {
tailwindConfig.content = tailwindConfig.content ?? []
tailwindConfig.content.push(`${nuxt.options.buildDir}/cache/content/parsed/**/*.md`)
})
}
})

Expand Down

0 comments on commit 8e568c2

Please sign in to comment.