You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, thanks for opening an issue on this repository - it's a good question.
Content configuration could be a bit varied, so hooks just need minor if-conditions to extend this. See how the FormKit module does this. In your case, this is what we'll do:
exportconstconfigureTailwind=(tailwindConfig: Partial<Config>,srcResolver: Resolver)=>{construntimeDir=srcResolver.resolve("./runtime");// in case `content: undefined` which is highly unlikely, we provide default valuetailwindConfig.content=tailwindConfig.content??{files: []}if(Array.isArray(tailwindConfig.content)){// content: string[]tailwindConfig.content.push(...)}else{tailwindConfig.content.files.push(srcResolver.resolve(runtimeDir,"components/**/*.{vue,mjs,ts}"));tailwindConfig.content.files.push(srcResolver.resolve(runtimeDir,"config/**/*.{vue,mjs,ts}"));}};
It's likely that in your hook, tailwindConfig.content was a simple array of paths, so Array.prototype.files was undefined. I do think of extending this module to always pass content as an object as a future improvement, but devs should also ensure safer hooks to support different Tailwind configurations. 🙂
Hello,
There is a change that occurs between nuxt/ui 2.15.1 and 2.16.0.
In 2.15.1, I was able to specify paths in the tailwindConfig.content.files doing the following in my module :
This function is called on the module.ts on the hook tailwindcss:config :
In the last version, I am having the tailwindConfig.content.files undefined sometimes when calling the pnpm run dev:prepare
I think I am not using the good way to do that.
My project is a mono repo with severals nuxt module that depends of nuxt/ui and can have dependencies between them.
Please, can you give me the clean way to provide the content files to tailwind css from nuxt modules ?
Thank you
The text was updated successfully, but these errors were encountered: