hepru / yii2-minify-view2
Yii2 View component with auto minification css & js in runtime
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- mrclay/minify: 3.0.7
- pimple/pimple: ~3.2.0
- yiisoft/yii2: ^2.0
Requires (Dev)
- monolog/monolog: ^1.1
- phpdocumentor/reflection-docblock: ~3.1.0
- phpunit/phpunit: ^6.0
This package is auto-updated.
Last update: 2025-06-12 09:53:30 UTC
README
The main feature of this component - concatenate and compress files connected through "AssetBundle".
Code Status
Support
Installation
The preferred way to install this extension is through composer.
Either run
composer require hepru/yii2-minify-view2
or add
"hepru/yii2-minify-view2": "^1.0",
to the require
section of your composer.json
file.
Configure
<?php return [ // ... 'components' => [ // ... 'view' => [ 'class' => '\hepru\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 ], ] ] ];