From 08436e5085642fbd0bbfb71c68fc4051765d7b89 Mon Sep 17 00:00:00 2001 From: Simon Tretter Date: Thu, 9 Feb 2023 18:21:55 +0100 Subject: [PATCH] support nuxt 2.16+ fixes https://github.com/nuxt-modules/tailwindcss/issues/609 --- src/module.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/module.ts b/src/module.ts index f5df1588..25f07402 100644 --- a/src/module.ts +++ b/src/module.ts @@ -10,6 +10,7 @@ import { addTemplate, addDevServerHandler, isNuxt2, + getNuxtVersion, createResolver, resolvePath, addVitePlugin, @@ -269,7 +270,11 @@ export default defineNuxtModule({ postcssOptions.plugins['postcss-custom-properties'] = postcssOptions.plugins['postcss-custom-properties'] ?? {} postcssOptions.plugins.tailwindcss = tailwindConfig - if (isNuxt2()) { + /* + * install postcss8 module on nuxt < 2.16 + */ + const nuxtVersion = getNuxtVersion(nuxt).split('.'); + if (parseInt(nuxtVersion[0], 10) === 2 && parseInt(nuxtVersion[1], 10) < 16) { await installModule('@nuxt/postcss8') }