Skip to content

Commit

Permalink
Make LazyInstallCommand interactive
Browse files Browse the repository at this point in the history
Updated LazyInstallCommand to interactively ask users which tailwind configuration they want to use. Users can now choose between 'tailwind.config.js' and 'tailwind.lazy.config.js', or opt to ignore this step entirely. This improvement aims to facilitate customization and provides users with more autonomy during the setup process.
  • Loading branch information
CrazyBoy49z committed Oct 15, 2023
1 parent 9c5ea25 commit 16bfffc
Showing 1 changed file with 31 additions and 2 deletions.
33 changes: 31 additions & 2 deletions src/Commands/LazyInstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use function Laravel\Prompts\confirm;
use function Laravel\Prompts\info;
use function Laravel\Prompts\select;

class LazyInstallCommand extends Command
{
Expand Down Expand Up @@ -51,11 +52,39 @@ public function handle(): int
copy(__DIR__.'/../../stubs/postcss.config.js', base_path('postcss.config.js'));
}

if (! file_exists(base_path('tailwind.config.js'))) {
$select = select(
label: 'What type config do you want to use?',
options: [
'tailwind.config.js' => 'tailwind.config.js',
'tailwind.lazy.config.js' => 'tailwind.lazy.config.js If you use tailwindcss on site, you can use this config',
'ignore' => 'Ignore',
],
default: 'tailwind.lazy.config.js',
);

if ($select === 'ignore') {
return self::SUCCESS;
}

if ($select === 'tailwind.config.js') {
info('Copy tailwind.config.js');
copy(__DIR__.'/../../stubs/tailwind.lazy.config.js', base_path('tailwind.config.js'));
copy(__DIR__.'/../../stubs/tailwind.config.js', base_path('tailwind.config.js'));

return self::SUCCESS;
}

if ($select === 'tailwind.lazy.config.js') {
info('Copy tailwind.lazy.config.js');

copy(__DIR__.'/../../stubs/tailwind.lazy.config.js', base_path('tailwind.lazy.config.js'));

info('use @config "path to file/tailwind.admin.config.js" in your css file');

return self::SUCCESS;
}

info('success');

return self::SUCCESS;
}
}

0 comments on commit 16bfffc

Please sign in to comment.