Compare View
Commits (2)
Showing
2 changed files
Show diff stats
composer.json
| ... | ... | @@ -33,7 +33,8 @@ |
| 33 | 33 | "kartik-v/yii2-widget-select2": "@dev", |
| 34 | 34 | "artweb/artbox-core": "@dev", |
| 35 | 35 | "artweb/artbox-weblog": "@dev", |
| 36 | - "artweb/artbox-webcomment": "@dev" | |
| 36 | + "artweb/artbox-webcomment": "@dev", | |
| 37 | + "skeeks/yii2-assets-auto-compress": "*" | |
| 37 | 38 | }, |
| 38 | 39 | "require-dev": { |
| 39 | 40 | "yiisoft/yii2-debug": "~2.0.0", | ... | ... |
frontend/config/main.php
| ... | ... | @@ -3,61 +3,117 @@ |
| 3 | 3 | use artbox\core\components\SeoUrlManager; |
| 4 | 4 | |
| 5 | 5 | $params = array_merge( |
| 6 | - require(__DIR__ . '/../../common/config/params.php'), | |
| 7 | - require(__DIR__ . '/../../common/config/params-local.php'), | |
| 8 | - require(__DIR__ . '/params.php'), | |
| 9 | - require(__DIR__ . '/params-local.php') | |
| 10 | -); | |
| 11 | - | |
| 12 | -return [ | |
| 13 | - 'id' => 'app-frontend', | |
| 14 | - 'homeUrl' => '/', | |
| 15 | - 'basePath' => dirname(__DIR__), | |
| 16 | - 'bootstrap' => ['log'], | |
| 17 | - 'controllerNamespace' => 'frontend\controllers', | |
| 18 | - 'components' => [ | |
| 19 | - 'request' => [ | |
| 20 | - 'class' => LanguageRequest::className(), | |
| 21 | - 'csrfParam' => '_csrf-frontend', | |
| 22 | - 'baseUrl' => '', | |
| 23 | - ], | |
| 24 | - 'user' => [ | |
| 25 | - 'identityClass' => 'common\models\User', | |
| 26 | - 'enableAutoLogin' => true, | |
| 27 | - 'identityCookie' => ['name' => '_identity-frontend', 'httpOnly' => true], | |
| 28 | - ], | |
| 29 | - 'session' => [ | |
| 30 | - // this is the name of the session cookie used for login on the frontend | |
| 31 | - 'name' => 'advanced-frontend', | |
| 32 | - ], | |
| 33 | - 'log' => [ | |
| 34 | - 'traceLevel' => YII_DEBUG ? 3 : 0, | |
| 35 | - 'targets' => [ | |
| 36 | - [ | |
| 37 | - 'class' => 'yii\log\FileTarget', | |
| 38 | - 'levels' => ['error', 'warning'], | |
| 6 | + require( __DIR__ . '/../../common/config/params.php' ), | |
| 7 | + require( __DIR__ . '/../../common/config/params-local.php' ), | |
| 8 | + require( __DIR__ . '/params.php' ), | |
| 9 | + require( __DIR__ . '/params-local.php' ) | |
| 10 | + ); | |
| 11 | + | |
| 12 | + return [ | |
| 13 | + 'id' => 'app-frontend', | |
| 14 | + 'homeUrl' => '/', | |
| 15 | + 'basePath' => dirname(__DIR__), | |
| 16 | + 'bootstrap' => YII_ENV_PROD ? [ | |
| 17 | + 'log', | |
| 18 | + 'assetsAutoCompress', | |
| 19 | + ] : [ 'log' ], | |
| 20 | + 'controllerNamespace' => 'frontend\controllers', | |
| 21 | + 'components' => [ | |
| 22 | + 'request' => [ | |
| 23 | + 'class' => LanguageRequest::className(), | |
| 24 | + 'csrfParam' => '_csrf-frontend', | |
| 25 | + 'baseUrl' => '', | |
| 26 | + ], | |
| 27 | + 'user' => [ | |
| 28 | + 'identityClass' => 'common\models\User', | |
| 29 | + 'enableAutoLogin' => true, | |
| 30 | + 'identityCookie' => [ | |
| 31 | + 'name' => '_identity-frontend', | |
| 32 | + 'httpOnly' => true, | |
| 39 | 33 | ], |
| 40 | 34 | ], |
| 41 | - ], | |
| 42 | - 'errorHandler' => [ | |
| 43 | - 'errorAction' => 'site/error', | |
| 44 | - ], | |
| 45 | - 'urlManager' => [ | |
| 46 | - 'class' => SeoUrlManager::className(), | |
| 47 | - 'enablePrettyUrl' => true, | |
| 48 | - 'showScriptName' => false, | |
| 49 | -// 'dontShowDefaulPrefix' => true, | |
| 50 | - 'rules' => [ | |
| 51 | - '\/robots.txt' => 'site/robots', | |
| 35 | + 'session' => [ | |
| 36 | + // this is the name of the session cookie used for login on the frontend | |
| 37 | + 'name' => 'advanced-frontend', | |
| 38 | + ], | |
| 39 | + 'log' => [ | |
| 40 | + 'traceLevel' => YII_DEBUG ? 3 : 0, | |
| 41 | + 'targets' => [ | |
| 42 | + [ | |
| 43 | + 'class' => 'yii\log\FileTarget', | |
| 44 | + 'levels' => [ | |
| 45 | + 'error', | |
| 46 | + 'warning', | |
| 47 | + ], | |
| 48 | + ], | |
| 49 | + ], | |
| 50 | + ], | |
| 51 | + 'errorHandler' => [ | |
| 52 | + 'errorAction' => 'site/error', | |
| 53 | + ], | |
| 54 | + 'urlManager' => [ | |
| 55 | + 'class' => SeoUrlManager::className(), | |
| 56 | + 'enablePrettyUrl' => true, | |
| 57 | + 'showScriptName' => false, | |
| 58 | + // 'dontShowDefaulPrefix' => true, | |
| 59 | + 'rules' => [ | |
| 60 | + '\/robots.txt' => 'site/robots', | |
| 61 | + ], | |
| 62 | + 'processRoutes' => [ | |
| 63 | + 'object/view', | |
| 64 | + 'blog/article', | |
| 65 | + 'blog/tag', | |
| 66 | + 'blog/category', | |
| 67 | + 'page/view', | |
| 68 | + ], | |
| 52 | 69 | ], |
| 53 | - 'processRoutes' => [ | |
| 54 | - 'object/view', | |
| 55 | - 'blog/article', | |
| 56 | - 'blog/tag', | |
| 57 | - 'blog/category', | |
| 58 | - 'page/view', | |
| 70 | + 'assetsAutoCompress' => [ | |
| 71 | + 'class' => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent', | |
| 72 | + 'enabled' => true, | |
| 73 | + | |
| 74 | + 'readFileTimeout' => 3, | |
| 75 | + //Time in seconds for reading each asset file | |
| 76 | + | |
| 77 | + 'jsCompress' => true, | |
| 78 | + //Enable minification js in html code | |
| 79 | + 'jsCompressFlaggedComments' => true, | |
| 80 | + //Cut comments during processing js | |
| 81 | + | |
| 82 | + 'cssCompress' => true, | |
| 83 | + //Enable minification css in html code | |
| 84 | + | |
| 85 | + 'cssFileCompile' => true, | |
| 86 | + //Turning association css files | |
| 87 | + 'cssFileRemouteCompile' => false, | |
| 88 | + //Trying to get css files to which the specified path as the remote file, skchat him to her. | |
| 89 | + 'cssFileCompress' => true, | |
| 90 | + //Enable compression and processing before being stored in the css file | |
| 91 | + 'cssFileBottom' => false, | |
| 92 | + //Moving down the page css files | |
| 93 | + 'cssFileBottomLoadOnJs' => false, | |
| 94 | + //Transfer css file down the page and uploading them using js | |
| 95 | + | |
| 96 | + 'jsFileCompile' => true, | |
| 97 | + //Turning association js files | |
| 98 | + 'jsFileRemouteCompile' => false, | |
| 99 | + //Trying to get a js files to which the specified path as the remote file, skchat him to her. | |
| 100 | + 'jsFileCompress' => true, | |
| 101 | + //Enable compression and processing js before saving a file | |
| 102 | + 'jsFileCompressFlaggedComments' => true, | |
| 103 | + //Cut comments during processing js | |
| 104 | + | |
| 105 | + 'htmlCompress' => true, | |
| 106 | + //Enable compression html | |
| 107 | + 'noIncludeJsFilesOnPjax' => true, | |
| 108 | + //Do not connect the js files when all pjax requests | |
| 109 | + 'htmlCompressOptions' => //options for compressing output result | |
| 110 | + [ | |
| 111 | + 'extra' => false, | |
| 112 | + //use more compact algorithm | |
| 113 | + 'no-comments' => true | |
| 114 | + //cut all the html comments | |
| 115 | + ], | |
| 59 | 116 | ], |
| 60 | 117 | ], |
| 61 | - ], | |
| 62 | - 'params' => $params, | |
| 63 | -]; | |
| 118 | + 'params' => $params, | |
| 119 | + ]; | ... | ... |