PHP
Switch branches/tags
Clone or download
Pull request Compare This branch is 55 commits ahead, 149 commits behind rmrevin:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore Init Mar 24, 2014
Minify_HTML.php Update Minify_HTML.php Oct 26, 2015
README.md
View.php Add remove multiple comments in js Nov 13, 2015
composer.json Update composer file Jul 6, 2015

README.md

Yii 2 Minify View Component

Latest Stable Version Latest Unstable Version Total Downloads License

Installation

The preferred way to install this extension is through composer.

Add github repository

    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/mirocow/yii2-minify-view.git"
        }
    ]

and then

php composer.phar require --prefer-dist "mirocow/yii2-minify-view" "*"

or add

"mirocow/yii2-minify-view" : "*"

to the require section of your application's composer.json file.

Configure

<?
return [
	// ...
	'components' => [
		// ...
    'view' => [
      'class' => '\mirocow\minify\View',
      'base_path' => '@app/web', // path alias to web base
      'minify_path' => '@app/web/minify', // path alias to save minify result
      'minify_css' => true,
      'minify_js' => true,
      'minify_html' => true,
      'js_len_to_minify' => 1000, // Больше этого размера inlinejs будет сжиматься и упаковываться в файл
      'force_charset' => 'UTF-8', // charset forcibly assign, otherwise will use all of the files found charset
      'expand_imports' => true, // whether to change @import on content
      //'css_linebreak_pos' => false,
      
      // Theming
      'theme' => [
        'basePath' => '@app/themes/myapp',
        'baseUrl' => '@app/themes/myapp',
        'pathMap' => [ 
          '@app/modules' => '@app/themes/myapp/modules',
          /*'@app/views' => [ 
            '@webroot/themes/myapp/views',
          ]*/
        ],
      ],          
      
    ],
	]
];