Skip to content

Commit 16bfffc

Browse files
committed
Make LazyInstallCommand interactive
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.
1 parent 9c5ea25 commit 16bfffc

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

src/Commands/LazyInstallCommand.php

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
use function Laravel\Prompts\confirm;
88
use function Laravel\Prompts\info;
9+
use function Laravel\Prompts\select;
910

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

54-
if (! file_exists(base_path('tailwind.config.js'))) {
55+
$select = select(
56+
label: 'What type config do you want to use?',
57+
options: [
58+
'tailwind.config.js' => 'tailwind.config.js',
59+
'tailwind.lazy.config.js' => 'tailwind.lazy.config.js If you use tailwindcss on site, you can use this config',
60+
'ignore' => 'Ignore',
61+
],
62+
default: 'tailwind.lazy.config.js',
63+
);
64+
65+
if ($select === 'ignore') {
66+
return self::SUCCESS;
67+
}
68+
69+
if ($select === 'tailwind.config.js') {
5570
info('Copy tailwind.config.js');
56-
copy(__DIR__.'/../../stubs/tailwind.lazy.config.js', base_path('tailwind.config.js'));
71+
copy(__DIR__.'/../../stubs/tailwind.config.js', base_path('tailwind.config.js'));
72+
73+
return self::SUCCESS;
74+
}
75+
76+
if ($select === 'tailwind.lazy.config.js') {
77+
info('Copy tailwind.lazy.config.js');
78+
79+
copy(__DIR__.'/../../stubs/tailwind.lazy.config.js', base_path('tailwind.lazy.config.js'));
80+
81+
info('use @config "path to file/tailwind.admin.config.js" in your css file');
82+
83+
return self::SUCCESS;
5784
}
5885

86+
info('success');
87+
5988
return self::SUCCESS;
6089
}
6190
}

0 commit comments

Comments
 (0)