From 9ae185c18eb06e3ce7e2daea0c61e6f6478bdca9 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Thu, 25 Jul 2019 11:16:21 -0700 Subject: Remove dependency on Sass - Convert *.sass files to vanilla CSS - Start using CSS variables - Add PHP minifier --- app/Console/CssCommand.php | 126 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 app/Console/CssCommand.php (limited to 'app/Console') diff --git a/app/Console/CssCommand.php b/app/Console/CssCommand.php new file mode 100644 index 00000000..f141519e --- /dev/null +++ b/app/Console/CssCommand.php @@ -0,0 +1,126 @@ +setName('css') + ->setDescription('Minify CSS') + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $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'); + } + + private function minifyFiles($folder, array $files, $destination) + { + $minifier = new Minify\CSS(); + + foreach ($files as $file) { + $filename = $folder. $file; + if (! file_exists($filename)) { + die("$filename not found\n"); + } + $minifier->add($filename); + } + + $minifier->minify(self::CSS_DIST_PATH . $destination); + } +} -- cgit v1.2.3