diff options
author | Frédéric Guillot <fred@kanboard.net> | 2019-07-25 19:23:30 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2019-07-25 19:23:30 -0700 |
commit | 8c396287ac871c1a5aaf0a4bc608df101f677d1d (patch) | |
tree | 4c96460e20c34c646595d0b3e09a00b086551534 /app/Console/JsCommand.php | |
parent | d42dd0705481bacf38c8d2a6c915398046ead014 (diff) |
Improve assets management
Diffstat (limited to 'app/Console/JsCommand.php')
-rw-r--r-- | app/Console/JsCommand.php | 26 |
1 files changed, 2 insertions, 24 deletions
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; - } } |