/** * Enable Caching * * Allows you to enable caching on a page by page basis * @example $this->smarty->enable_caching(); then do your parse call */ public function index() { $sourcePath = '/home/user/development/leonardo/application/modules/templates/views/tnt/theme/css/animate.css'; $minifier = new Minify\CSS($sourcePath); // we can even add another file, they'll then be // joined in 1 output file //$sourcePath2 = '/path/to/second/source/css/file.css'; //$minifier->add($sourcePath2); // or we can just add plain CSS $css = 'body { color: #000000; }'; $minifier->add($css); // save minified file to disk $minifiedPath = '/path/to/minified/css/file.css'; $minifier->minify($minifiedPath); // or just output the content return $minifier->minify(); }
/** * @param string $type * @return \Difra\Minify\Common */ public static function getInstance($type) { switch ($type) { case 'css': return Minify\CSS::getInstance(); case 'js': return Minify\JS::getInstance(); default: return Minify\None::getInstance(); } }