4
4
5
5
use Illuminate \Console \Command ;
6
6
use Illuminate \Support \Facades \File ;
7
- use Symfony \ Component \ Process \Process ;
7
+ use Illuminate \ Support \ Facades \Process ;
8
8
use Tonysm \TailwindCss \Manifest ;
9
9
10
10
class BuildCommand extends Command
@@ -16,6 +16,7 @@ class BuildCommand extends Command
16
16
{--digest : If you want the final CSS file to be generated using a digest of its contents (does not work with the --watch flag).}
17
17
{--prod : This option combines the --minify and --digest options. Ideal for production.}
18
18
' ;
19
+
19
20
protected $ description = 'Generates a new build of Tailwind CSS for your project. ' ;
20
21
21
22
public function handle ()
@@ -33,7 +34,7 @@ public function handle()
33
34
$ sourcePath = $ this ->fixFilePathForOs (config ('tailwindcss.build.source_file_path ' ));
34
35
$ sourceRelativePath = str_replace (rtrim (resource_path (), DIRECTORY_SEPARATOR ), '' , $ sourcePath );
35
36
$ destinationPath = $ this ->fixFilePathForOs (config ('tailwindcss.build.destination_path ' ));
36
- $ destinationFileAbsolutePath = $ destinationPath . DIRECTORY_SEPARATOR . trim ($ sourceRelativePath , DIRECTORY_SEPARATOR );
37
+ $ destinationFileAbsolutePath = $ destinationPath. DIRECTORY_SEPARATOR . trim ($ sourceRelativePath , DIRECTORY_SEPARATOR );
37
38
$ destinationFileRelativePath = str_replace (rtrim (public_path (), DIRECTORY_SEPARATOR ), '' , $ destinationFileAbsolutePath );
38
39
39
40
File::ensureDirectoryExists (dirname ($ destinationFileAbsolutePath ));
@@ -46,19 +47,18 @@ public function handle()
46
47
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES ));
47
48
}
48
49
49
- $ process = new Process (array_filter ([
50
- $ binFile ,
51
- '-i ' , $ sourcePath ,
52
- '-o ' , $ destinationFileAbsolutePath ,
53
- $ this ->option ('watch ' ) ? '-w ' : null ,
54
- $ this ->shouldMinify () ? '-m ' : null ,
55
- ]), timeout: null );
56
- $ process ->setWorkingDirectory (base_path ());
57
- $ process ->setPty (true );
58
-
59
- $ process ->run (function ($ type , $ buffer ) {
60
- $ this ->output ->write ($ buffer );
61
- });
50
+ Process::forever ()
51
+ ->tty (true )
52
+ ->path (base_path ())
53
+ ->run (array_filter ([
54
+ $ binFile ,
55
+ '-i ' , $ sourcePath ,
56
+ '-o ' , $ destinationFileAbsolutePath ,
57
+ $ this ->option ('watch ' ) ? '-w ' : null ,
58
+ $ this ->shouldMinify () ? '-m ' : null ,
59
+ ]), function ($ type , $ output ) {
60
+ $ this ->output ->write ($ output );
61
+ });
62
62
63
63
if ($ this ->shouldVersion ()) {
64
64
$ destinationFileAbsolutePath = $ this ->ensureAssetIsVersioned ($ destinationFileAbsolutePath );
0 commit comments