public function minify($path)
    {
        $filePath = $this->destPath.'/'.$path;
        if (is_file($filePath)) {
            $extension = (new \SplFileInfo($filePath))->getExtension();
            switch ($extension) {
                case 'css':
                    $minifier = new Minify\CSS($filePath);
                    break;
                case 'js':
                    $minifier = new Minify\JS($filePath);
                    break;
                default:
                    throw new Exception(sprintf("File '%s' should be a '.css' or a '.js'!", $path));
            }
            $minifier->minify($filePath);

            return $path;
        }

        throw new Exception(sprintf("File '%s' doesn't exist!", $path));
    }
public function minify($path)
    {
        $filePath = $this->destPath.'/'.$path;
        if (is_file($filePath)) {
            $extension = (new \SplFileInfo($filePath))->getExtension();
            switch ($extension) {
                case 'css':
                    $minifier = new Minify\CSS($filePath);
                    break;
                case 'js':
                    $minifier = new Minify\JS($filePath);
                    break;
                default:
                    throw new Exception(sprintf("File '%s' should be a '.css' or a '.js'!", $path));
            }
            $minifier->minify($filePath);

            return $path;
        }

        throw new Exception(sprintf("File '%s' doesn't exist!", $path));
    }
public function minify ( $ path ) { $ filePath = $ this -> destPath . '/' . $ path ; if ( is_file ( $ filePath ) ) { $ extension = ( new \ SplFileInfo ( $ filePath ) ) -> getExtension ( ) ; switch ( $ extension ) { case 'css' : $ minifier = new Minify \ CSS ( $ filePath ) ; break ; case 'js' : $ minifier = new Minify \ JS ( $ filePath ) ; break ; default : throw new Exception ( sprintf ( "File '%s' should be a '.css' or a '.js'!" , $ path ) ) ; } $ minifier -> minify ( $ filePath ) ; return $ path ; } throw new Exception ( sprintf ( "File '%s' doesn't exist!" , $ path ) ) ; }
Minify a CSS or a JS file.

@param string $path

@throws Exception

@return string
Minify a CSS or a JS file .