From 8ae4e3885dddbdda2f77a8e940edd819e9246bb5 Mon Sep 17 00:00:00 2001 From: Harish Kumar Date: Wed, 15 May 2024 20:06:08 +0530 Subject: [PATCH] fix: tailwindcss to vite preset --- src/Presets/Vite/TailwindPreset.php | 3 ++- src/Presets/Vite/VitePresetExport.php | 1 + stubs/Presets/vite.config.js | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Presets/Vite/TailwindPreset.php b/src/Presets/Vite/TailwindPreset.php index f13cf20..a9641c7 100644 --- a/src/Presets/Vite/TailwindPreset.php +++ b/src/Presets/Vite/TailwindPreset.php @@ -73,7 +73,7 @@ public function getViteConfig() return 'css: { postcss: { plugins: [ - require("tailwindcss")({ + tailwindcss({ config: path.resolve(__dirname, "tailwind.config.js"), }), ], @@ -84,6 +84,7 @@ public function getViteConfig() public function updateViteConfig($configData) { $configData = str_replace('%app_css_input%', 'css/app.css', $configData); + $configData = str_replace('%tailwind_import%', 'import tailwindcss from "tailwindcss";', $configData); return str_replace('%css_config%', $this->getViteConfig(), $configData); } diff --git a/src/Presets/Vite/VitePresetExport.php b/src/Presets/Vite/VitePresetExport.php index 27bc5ff..9d732a0 100644 --- a/src/Presets/Vite/VitePresetExport.php +++ b/src/Presets/Vite/VitePresetExport.php @@ -84,6 +84,7 @@ public function exportViteConfig() '%theme_path%', '%theme_name%', '%css_config%', + '%tailwind_import%', '%vue_import%', '%vue_plugin_config%', '%react_import%', diff --git a/stubs/Presets/vite.config.js b/stubs/Presets/vite.config.js index cb1bd37..b6ba8cb 100644 --- a/stubs/Presets/vite.config.js +++ b/stubs/Presets/vite.config.js @@ -1,6 +1,7 @@ import { defineConfig } from "vite"; import laravel from "laravel-vite-plugin"; import path from "path"; +%tailwind_import% %vue_import% %react_import%