setName('css') ->setDescription('Minify CSS files') ; } 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'); $vendorBundle = concat_files($this->vendorFiles); file_put_contents('assets/css/vendor.min.css', $vendorBundle); } 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); } }