Skip to content

Commit

Permalink
chore: safer code
Browse files Browse the repository at this point in the history
  • Loading branch information
ineshbose authored May 16, 2023
1 parent 0195869 commit b921f4b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,8 +634,15 @@ export default defineNuxtModule<ModuleOptions>({
// @nuxtjs/tailwindcss support
// @ts-ignore - Module might not exist
nuxt.hook('tailwindcss:config', (tailwindConfig) => {
tailwindConfig.content = tailwindConfig.content ?? [];
(Array.isArray(tailwindConfig.content) ? tailwindConfig.content : tailwindConfig.content.files).push(resolve(nuxt.options.buildDir, 'content-cache', 'parsed/**/*.md'))
const contentPath = resolve(nuxt.options.buildDir, 'content-cache', 'parsed/**/*.md')
tailwindConfig.content = tailwindConfig.content ?? []

if (Array.isArray(tailwindConfig.content)) {
tailwindConfig.content.push(contentPath)
} else {
tailwindConfig.content.files = tailwindConfig.content.files ?? []
tailwindConfig.content.files.push(contentPath)
}
})

// ignore files
Expand Down

0 comments on commit b921f4b

Please sign in to comment.