Commit 545a411b2f172c9c2e8343278c951a0f70108140

Authored by alex
1 parent eaa321f3

add autocompress

Showing 1 changed file with 49 additions and 2 deletions   Show diff stats
frontend/config/main.php
... ... @@ -23,7 +23,7 @@
23 23 'id' => 'app-frontend',
24 24 'homeUrl' => '/',
25 25 'basePath' => dirname(__DIR__),
26   - 'bootstrap' => [ 'log' ],
  26 + 'bootstrap' => [ 'log','assetsAutoCompress' ],
27 27 'controllerNamespace' => 'frontend\controllers',
28 28 'container' => [
29 29 'singletons' => [
... ... @@ -374,10 +374,57 @@
374 374 'enablePrettyUrl' => true,
375 375 'showScriptName' => false,
376 376 'rules' => [
377   -
  377 +
378 378 ],
379 379 'hideDefaultLanguagePrefix' => true,
380 380 ],
  381 + 'assetsAutoCompress' => [
  382 + 'class' => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent',
  383 + 'enabled' => true,
  384 +
  385 + 'readFileTimeout' => 3,
  386 + //Time in seconds for reading each asset file
  387 +
  388 + 'jsCompress' => true,
  389 + //Enable minification js in html code
  390 + 'jsCompressFlaggedComments' => true,
  391 + //Cut comments during processing js
  392 +
  393 + 'cssCompress' => true,
  394 + //Enable minification css in html code
  395 +
  396 + 'cssFileCompile' => true,
  397 + //Turning association css files
  398 + 'cssFileRemouteCompile' => false,
  399 + //Trying to get css files to which the specified path as the remote file, skchat him to her.
  400 + 'cssFileCompress' => true,
  401 + //Enable compression and processing before being stored in the css file
  402 + 'cssFileBottom' => false,
  403 + //Moving down the page css files
  404 + 'cssFileBottomLoadOnJs' => false,
  405 + //Transfer css file down the page and uploading them using js
  406 +
  407 + 'jsFileCompile' => true,
  408 + //Turning association js files
  409 + 'jsFileRemouteCompile' => false,
  410 + //Trying to get a js files to which the specified path as the remote file, skchat him to her.
  411 + 'jsFileCompress' => true,
  412 + //Enable compression and processing js before saving a file
  413 + 'jsFileCompressFlaggedComments' => true,
  414 + //Cut comments during processing js
  415 +
  416 + 'htmlCompress' => true,
  417 + //Enable compression html
  418 + 'noIncludeJsFilesOnPjax' => true,
  419 + //Do not connect the js files when all pjax requests
  420 + 'htmlCompressOptions' => //options for compressing output result
  421 + [
  422 + 'extra' => false,
  423 + //use more compact algorithm
  424 + 'no-comments' => true
  425 + //cut all the html comments
  426 + ],
  427 + ],
381 428 ],
382 429  
383 430 'params' => $params,
... ...