summaryrefslogtreecommitdiff
path: root/app/Console
diff options
context:
space:
mode:
Diffstat (limited to 'app/Console')
-rw-r--r--app/Console/CssCommand.php14
-rw-r--r--app/Console/JsCommand.php26
2 files changed, 10 insertions, 30 deletions
diff --git a/app/Console/CssCommand.php b/app/Console/CssCommand.php
index a246a0db..0cb9a38a 100644
--- a/app/Console/CssCommand.php
+++ b/app/Console/CssCommand.php
@@ -87,11 +87,11 @@ class CssCommand extends BaseCommand
];
private $vendorFiles = [
- 'jquery-ui/jquery-ui.min.css',
- 'jqueryui-timepicker-addon/jquery-ui-timepicker-addon.min.css',
- 'select2/css/select2.min.css',
- 'font-awesome/css/font-awesome.min.css',
- 'c3/c3.min.css',
+ self::CSS_VENDOR_PATH.'jquery-ui/jquery-ui.min.css',
+ self::CSS_VENDOR_PATH.'jqueryui-timepicker-addon/jquery-ui-timepicker-addon.min.css',
+ self::CSS_VENDOR_PATH.'select2/css/select2.min.css',
+ self::CSS_VENDOR_PATH.'font-awesome/css/font-awesome.min.css',
+ self::CSS_VENDOR_PATH.'c3/c3.min.css',
];
protected function configure()
@@ -106,7 +106,9 @@ class CssCommand extends BaseCommand
{
$this->minifyFiles(self::CSS_SRC_PATH, $this->appFiles, 'app.min.css');
$this->minifyFiles(self::CSS_SRC_PATH, $this->printFiles, 'print.min.css');
- $this->minifyFiles(self::CSS_VENDOR_PATH, $this->vendorFiles, 'vendor.min.css');
+
+ $vendorBundle = concat_files($this->vendorFiles);
+ file_put_contents('assets/css/vendor.min.css', $vendorBundle);
}
private function minifyFiles($folder, array $files, $destination)
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;
- }
}