PHP Class Minify_YUICompressor, minify

You must set $jarFile and $tempDir before calling the minify functions. Also, depending on your shell's environment, you may need to specify the full path to java in $javaExecutable or use putenv() to setup the Java environment. Minify_YUICompressor::$jarFile = '/path/to/yuicompressor-2.4.6.jar'; Minify_YUICompressor::$tempDir = '/tmp'; $code = Minify_YUICompressor::minifyJs( $code ,array('nomunge' => true, 'line-break' => 1000) ); Note: In case you run out stack (default is 512k), you may increase stack size in $options: array('stack-size' => '2048k')
Author: Stephen Clay ([email protected])
Afficher le fichier Open project: mrclay/minify Class Usage Examples

Méthodes publiques

Свойство Type Description
$jarFile string Filepath of the YUI Compressor jar file. This must be set before calling minifyJs() or minifyCss().
$javaExecutable string Filepath of "java" executable (may be needed if not in shell's PATH)
$tempDir string Writable temp directory. This must be set before calling minifyJs() or minifyCss().

Méthodes publiques

Méthode Description
minifyCss ( string $css, array $options = [] ) : string Minify a CSS string
minifyJs ( string $js, array $options = [] ) : string Minify a Javascript string

Private Methods

Méthode Description
_getCmd ( $userOptions, $type, $tmpFile )
_minify ( $type, $content, $options )
_prepare ( )

Method Details

minifyCss() public static méthode

Minify a CSS string
See also: http://www.julienlecomte.net/yuicompressor/README
public static minifyCss ( string $css, array $options = [] ) : string
$css string
$options array (verbose is ignored)
Résultat string

minifyJs() public static méthode

Minify a Javascript string
See also: http://www.julienlecomte.net/yuicompressor/README
public static minifyJs ( string $js, array $options = [] ) : string
$js string
$options array (verbose is ignored)
Résultat string

Property Details

$jarFile public_oe static_oe property

Filepath of the YUI Compressor jar file. This must be set before calling minifyJs() or minifyCss().
public static string $jarFile
Résultat string

$javaExecutable public_oe static_oe property

Filepath of "java" executable (may be needed if not in shell's PATH)
public static string $javaExecutable
Résultat string

$tempDir public_oe static_oe property

Writable temp directory. This must be set before calling minifyJs() or minifyCss().
public static string $tempDir
Résultat string