From 8c396287ac871c1a5aaf0a4bc608df101f677d1d Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Thu, 25 Jul 2019 19:23:30 -0700 Subject: Improve assets management --- app/Console/JsCommand.php | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'app/Console/JsCommand.php') diff --git a/app/Console/JsCommand.php b/app/Console/JsCommand.php index 4adf42be..15657715 100644 --- a/app/Console/JsCommand.php +++ b/app/Console/JsCommand.php @@ -79,34 +79,12 @@ class JsCommand extends BaseCommand protected function execute(InputInterface $input, OutputInterface $output) { - $appBundle = $this->concat($this->appFiles); - $vendorBundle = $this->concat($this->vendorFiles); + $appBundle = concat_files($this->appFiles); + $vendorBundle = concat_files($this->vendorFiles); $minifier = new Minify\JS($appBundle); file_put_contents('assets/js/app.min.js', $minifier->minify()); file_put_contents('assets/js/vendor.min.js', $vendorBundle); } - - private function concat(array $files) - { - $data = ''; - foreach ($files as $pattern) { - foreach (glob($pattern) as $filename) { - echo $filename.PHP_EOL; - if (! file_exists($filename)) { - die("$filename not found\n"); - } - - $contents = file_get_contents($filename); - if ($contents === false) { - die("Unable to read $filename\n"); - } - - $data .= $contents; - } - } - - return $data; - } } -- cgit v1.2.3