PHP code example of mirocow / yii2-minify-view

1. Go to this page and download the library: Download mirocow/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/ */

    

mirocow / yii2-minify-view example snippets


<?
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',
          ]*/
        ],
      ],          
      
    ],
	]
];