Skip to content

Commit

Permalink
Merge pull request #33 from tonysm/tm/update
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
tonysm authored Aug 13, 2024
2 parents f619851 + bc26d1c commit 7229010
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion config/tailwindcss.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,5 @@
| @see https://github.com/tailwindlabs/tailwindcss/releases to know the version availables.
|
*/
'version' => env('TAILWINDCSS_CLI_VERSION', 'v3.4.1'),
'version' => env('TAILWINDCSS_CLI_VERSION', 'v3.4.9'),
];
30 changes: 15 additions & 15 deletions src/Commands/BuildCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
use Symfony\Component\Process\Process;
use Illuminate\Support\Facades\Process;
use Tonysm\TailwindCss\Manifest;

class BuildCommand extends Command
Expand All @@ -16,6 +16,7 @@ class BuildCommand extends Command
{--digest : If you want the final CSS file to be generated using a digest of its contents (does not work with the --watch flag).}
{--prod : This option combines the --minify and --digest options. Ideal for production.}
';

protected $description = 'Generates a new build of Tailwind CSS for your project.';

public function handle()
Expand All @@ -33,7 +34,7 @@ public function handle()
$sourcePath = $this->fixFilePathForOs(config('tailwindcss.build.source_file_path'));
$sourceRelativePath = str_replace(rtrim(resource_path(), DIRECTORY_SEPARATOR), '', $sourcePath);
$destinationPath = $this->fixFilePathForOs(config('tailwindcss.build.destination_path'));
$destinationFileAbsolutePath = $destinationPath . DIRECTORY_SEPARATOR . trim($sourceRelativePath, DIRECTORY_SEPARATOR);
$destinationFileAbsolutePath = $destinationPath.DIRECTORY_SEPARATOR.trim($sourceRelativePath, DIRECTORY_SEPARATOR);
$destinationFileRelativePath = str_replace(rtrim(public_path(), DIRECTORY_SEPARATOR), '', $destinationFileAbsolutePath);

File::ensureDirectoryExists(dirname($destinationFileAbsolutePath));
Expand All @@ -46,19 +47,18 @@ public function handle()
], JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
}

$process = new Process(array_filter([
$binFile,
'-i', $sourcePath,
'-o', $destinationFileAbsolutePath,
$this->option('watch') ? '-w' : null,
$this->shouldMinify() ? '-m' : null,
]), timeout: null);
$process->setWorkingDirectory(base_path());
$process->setPty(true);

$process->run(function ($type, $buffer) {
$this->output->write($buffer);
});
Process::forever()
->tty(true)
->path(base_path())
->run(array_filter([
$binFile,
'-i', $sourcePath,
'-o', $destinationFileAbsolutePath,
$this->option('watch') ? '-w' : null,
$this->shouldMinify() ? '-m' : null,
]), function ($type, $output) {
$this->output->write($output);
});

if ($this->shouldVersion()) {
$destinationFileAbsolutePath = $this->ensureAssetIsVersioned($destinationFileAbsolutePath);
Expand Down
1 change: 1 addition & 0 deletions src/Commands/WatchCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class WatchCommand extends Command
{
protected $signature = 'tailwindcss:watch';

protected $description = 'Generates a new build of Tailwind CSS for your project, and keeps watching your files changes.';

public function handle()
Expand Down

0 comments on commit 7229010

Please sign in to comment.