myzend/minify

Zend Framework 2 module which uses the Steve (mrclay) Clay's Minify library for styles and scripts minification.

0.9.2 2013-07-19 19:20 UTC

This package is not auto-updated.

Last update: 2024-04-23 01:35:00 UTC


README

Usage

The view helper minifyFiles will create a uniquer minify file, which only will be generated again if you delete it.

Single file

$this->headScript()->appendFile($this->minify($this->basePath() . '/js/login/bootstrap.js'));
$this->headScript()->appendFile($this->minify($this->basePath() . '/js/login/jquery.validate.js'));

Group files, you can control files order

$this->headLink()->appendStylesheet(
							$this->minify(
								array(
									$this->basePath() . '/css/bootstrap/bootstrap.css',
									$this->basePath() . '/css/bootstrap/bootstrap-responsive.css',
									$this->basePath() . '/css/animate.css',
									$this->basePath() . '/css/main.css'
								)
							)
						);

Wildcard way

$this->headLink()->appendStylesheet($this->minify($this->basePath() . '/css/login/bootstrap/*.css'));

Other options

$this->headLink()->appendStylesheet(
							$this->minify(
								array(
									$this->basePath() . '/css/bootstrap/*.css',
									$this->basePath() . '/css/animate.css',
									$this->basePath() . '/css/main.css'
								)
							)
						);
Delete all files when deploy new changes.
find . -name "min-*" -exec rm -rf {} \;
Ignore minified files on your repository (.gitignore)
min-*