mirocow/yii2-minify-view

带有HTML、CSS和JS压缩功能的Yii2视图组件

安装次数: 4,205

依赖项: 0

建议者: 0

安全性: 0

星星: 9

关注者: 4

分支: 67

类型:yii2-extension

1.2.1 2014-07-28 13:23 UTC

This package is auto-updated.

Last update: 2024-09-14 18:36:54 UTC


README

Latest Stable Version Latest Unstable Version Total Downloads License

安装

安装此扩展的首选方式是通过 composer.

添加github仓库

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

然后

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

或添加

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

到您的应用程序的 composer.json 文件的require部分。

配置

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