1. Go to this page and download the library: Download rmrevin/yii2-minify-view library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rmrevin / yii2-minify-view example snippets
return [
// ...
'components' => [
// ...
'view' => [
'class' => '\rmrevin\yii\minify\View',
'enableMinify' => !YII_DEBUG,
'concatCss' => true, // concatenate css
'minifyCss' => true, // minificate css
'concatJs' => true, // concatenate js
'minifyJs' => true, // minificate js
'minifyOutput' => true, // minificate result html page
'webPath' => '@web', // path alias to web base
'basePath' => '@webroot', // path alias to web base
'minifyPath' => '@webroot/minify', // path alias to save minify result
'jsPosition' => [ \yii\web\View::POS_END ], // positions of js files to be minified
'forceCharset' => 'UTF-8', // charset forcibly assign, otherwise will use all of the files found charset
'expandImports' => true, // whether to change @import on content
'compressOptions' => ['extra' => true], // options for compress
'excludeFiles' => [
'jquery.js', // exclude this file from minification
'app-[^.].js', // you may use regexp
],
'excludeBundles' => [
\app\helloworld\AssetBundle::class, // exclude this bundle from minification
],
]
]
];
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.