Commit 44ac74b793940dd00b41218d378897ac9b396fa1

Authored by Anastasia
1 parent 1ec57a62

- add assets autocompress

Showing 1 changed file with 48 additions and 1 deletions   Show diff stats
frontend/config/main.php
... ... @@ -13,7 +13,7 @@
13 13 'id' => 'app-frontend',
14 14 'homeUrl' => '/',
15 15 'basePath' => dirname(__DIR__),
16   - 'bootstrap' => [ 'log' ],
  16 + 'bootstrap' => [ 'log', 'assetsAutoCompress', ],
17 17 'controllerNamespace' => 'frontend\controllers',
18 18 'container' => [
19 19 'singletons' => [
... ... @@ -314,6 +314,53 @@
314 314 'rules' => [],
315 315 'hideDefaultLanguagePrefix' => true,
316 316 ],
  317 + 'assetsAutoCompress' => [
  318 + 'class' => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
  319 + 'enabled' => true,
  320 +
  321 + 'readFileTimeout' => 3,
  322 + //Time in seconds for reading each asset file
  323 +
  324 + 'jsCompress' => true,
  325 + //Enable minification js in html code
  326 + 'jsCompressFlaggedComments' => true,
  327 + //Cut comments during processing js
  328 +
  329 + 'cssCompress' => true,
  330 + //Enable minification css in html code
  331 +
  332 + 'cssFileCompile' => true,
  333 + //Turning association css files
  334 + 'cssFileRemouteCompile' => false,
  335 + //Trying to get css files to which the specified path as the remote file, skchat him to her.
  336 + 'cssFileCompress' => true,
  337 + //Enable compression and processing before being stored in the css file
  338 + 'cssFileBottom' => false,
  339 + //Moving down the page css files
  340 + 'cssFileBottomLoadOnJs' => false,
  341 + //Transfer css file down the page and uploading them using js
  342 +
  343 + 'jsFileCompile' => true,
  344 + //Turning association js files
  345 + 'jsFileRemouteCompile' => false,
  346 + //Trying to get a js files to which the specified path as the remote file, skchat him to her.
  347 + 'jsFileCompress' => true,
  348 + //Enable compression and processing js before saving a file
  349 + 'jsFileCompressFlaggedComments' => true,
  350 + //Cut comments during processing js
  351 +
  352 + 'htmlCompress' => true,
  353 + //Enable compression html
  354 + 'noIncludeJsFilesOnPjax' => true,
  355 + //Do not connect the js files when all pjax requests
  356 + 'htmlCompressOptions' => //options for compressing output result
  357 + [
  358 + 'extra' => false,
  359 + //use more compact algorithm
  360 + 'no-comments' => true
  361 + //cut all the html comments
  362 + ],
  363 + ],
317 364 ],
318 365  
319 366 'params' => $params,
... ...