Download the PHP package yanli0303/yii-minify-client-script-package without Composer
On this page you can find all versions of the php package yanli0303/yii-minify-client-script-package. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download yanli0303/yii-minify-client-script-package
More information about yanli0303/yii-minify-client-script-package
Files in yanli0303/yii-minify-client-script-package
Package yii-minify-client-script-package
Short Description A PHP console application for minifying JavaScript and CSS files of a PHP Yii web application.
License MIT
Informations about the package yii-minify-client-script-package
Yii-MinifyClientScriptPackage
By Yan Li
A PHP console application for minifying JavaScript and CSS files of a PHP Yii web application.
Usage
-
Minify JavaScript and CSS files with Ant-MinifyJsCss
ant -Dsrc="path to Yii web application webroot" minify
-
Download yiimin.phar from downloads
- Open a new command/terminal window, change current directory to the Yii web app webroot, and execute following command
php yiimin.phar minify -v
Example
Take the protected/config/main.php:
Firstly you need to minify each local JavaScript and CSS files, after doing so, you'll have the following files:
- css/layout/pageHeader.min.css
- css/layout/pageFooter.min.css
- css/homePage/homePage.min.css
- js/homePage/homePage.min.js
Then, with this tool:
- Open a new terminal window, change current directory to YiiWebApp
- Run
php yiimin.phar minify -v
After that, your config file will be changed to:
And the assets/homePage_d8e21...fa8f7.min.css comprises the contents of following files:
- css/layout/pageHeader.min.css
- css/layout/pageFooter.min.css
- css/homePage/homePage.min.css
Limitations
- Better to only register one client script package on a page/view. If you registered several packages on a page, make sure the packages don't depend on a same package, otherwise the resources of the shared package will be loaded on the page multiple times;
- Don't use registerCssFile or registerScriptFile anymore; use registerPackage instead.
Run tests
Build PHAR from source
- Download box.phar
- Open a new terminal/command prompt window, change current directory to this console application
- Run
php /path/to/box.phar build
, new yiimin.phar will be created in downloads