From f06cf209a3d9e3b5f63bfdf939e2445d780962dc Mon Sep 17 00:00:00 2001 From: Daniel Cintra Date: Fri, 18 Oct 2024 21:54:18 -0300 Subject: [PATCH] Removes default Tailwind file during install. --- .../InstallerTraits/FrontendPackages.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/Console/InstallerTraits/FrontendPackages.php b/src/Console/InstallerTraits/FrontendPackages.php index 09b1a08..9df05c8 100644 --- a/src/Console/InstallerTraits/FrontendPackages.php +++ b/src/Console/InstallerTraits/FrontendPackages.php @@ -51,6 +51,8 @@ protected function installFrontendPackages(): void ] + $packages); + $this->removeDefaultTailwindConfig(); + // Config files... copy(__DIR__.'/../../../stubs/stack-configs/postcss.config.cjs', base_path('postcss.config.cjs')); copy(__DIR__.'/../../../stubs/stack-configs/tailwind.config.cjs', base_path('tailwind.config.cjs')); @@ -106,4 +108,20 @@ protected function runCommands(array $commands): void $this->output->write(' '.$line); }); } + + protected function removeDefaultTailwindConfig(): void + { + $tailwindConfigPath = base_path('tailwind.config.js'); + + if (! file_exists($tailwindConfigPath)) { + return; + } + + try { + unlink($tailwindConfigPath); + $this->info('Default tailwind.config.js removed.'); + } catch (\Exception $e) { + $this->error('Unable to remove default tailwind.config.js. Please check file permissions.'); + } + } }