siddthartha/yii2-asset-combiner

Asset combiner for Yii2

Installs: 135

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 4

Type:yii2-extension

dev-master 2017-04-03 11:32 UTC

This package is not auto-updated.

Last update: 2024-11-04 14:56:32 UTC


README

Yii 2 extension to compress and concatenate assets

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require siddthartha/yii2-asset-combiner

or add

"siddthartha/yii2-asset-combiner": "*"

to the require section of your composer.json file.

Конфигурация

        'view' => [
            // asset combiner config
            'class' => yii\web\View::className(),
            'as assetCombiner' => [
                'class' => \AssetCombiner\AssetCombinerBehavior::className(),

                // вкл-выкл, можно мерджить в конфигах в зависимости от environment dev, master, local
                'enabled' => true,

                // исключения из компиляции
                // можно указывать здесь (вендорные ассеты), а можно в конкретном ассете если наш
                // publishOptions = [ 'monolith' => false ] // принудительно выкл
                'exclude' => [
                ],
                /**/
                'filterJs' => [
                    'class' => \AssetCombiner\filters\UglifyJsFilter::className(),
                    'sourceMap' => false,
                    'compress' => false,
                    'mangle' => false,
                    'beautify' => true,
                    'keepFunctionNames' => true,
                    'keepComments' => true,
                ],
                /**/
                'filterCss' => [
                    'class' => \AssetCombiner\filters\UglifyCssFilter::className(),
                    'sort' => true,
                ],
                /**/
            ],
            // end of asset combiner config
            ...
        ],

Для работы фильтров

sudo npm -g install uglifyjs sudo npm -g install uglifycss