mix8872 / yii2-minify-view

Yii2 View component with minification css & js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yii 2 Minify View Component

The main feature of this component - concatenate and compress files connected through "AssetBundle".

License Latest Stable Version Latest Unstable Version Total Downloads

Code Status

Scrutinizer Code Quality Code Coverage Travis CI Build Status Dependency Status

Support

GutHub issues or public chat.

Installation

The preferred way to install this extension is through composer.

Either run

composer require mix8872/yii2-minify-view

or add

"mix8872/yii2-minify-view": "^1.15",

to the require section of your composer.json file.

Configure

<?php

return [
	// ...
	'components' => [
		// ...
		'view' => [
			'class' => '\mix8872\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
            ],
		]
	]
];

About

Yii2 View component with minification css & js

License:MIT License


Languages

Language:PHP 96.3%Language:CSS 2.6%Language:JavaScript 1.1%