From 03ffbf5bb95471764b4878537e3a6643dfcd18ed Mon Sep 17 00:00:00 2001 From: Anastasia Date: Tue, 12 Jun 2018 15:52:17 +0300 Subject: [PATCH] asset autocompress --- console/migrations/m180605_082938_alter_table_article.php | 40 ---------------------------------------- console/migrations/m181102_082938_alter_table_article.php | 40 ++++++++++++++++++++++++++++++++++++++++ frontend/assets/AppAsset.php | 4 ++-- frontend/assets/ScrollAsset.php | 2 +- frontend/config/main.php | 6 +++--- frontend/views/layouts/main.php | 2 +- frontend/views/site/index.php | 9 ++++++++- frontend/web/js/script.js | 20 +++++--------------- 8 files changed, 60 insertions(+), 63 deletions(-) delete mode 100644 console/migrations/m180605_082938_alter_table_article.php create mode 100644 console/migrations/m181102_082938_alter_table_article.php diff --git a/console/migrations/m180605_082938_alter_table_article.php b/console/migrations/m180605_082938_alter_table_article.php deleted file mode 100644 index 30b6588..0000000 --- a/console/migrations/m180605_082938_alter_table_article.php +++ /dev/null @@ -1,40 +0,0 @@ -addColumn('blog_article', 'views', $this->integer()->defaultValue(0)); - } - - /** - * {@inheritdoc} - */ - public function safeDown() - { - $this->dropColumn('blog_article', 'views'); - } - - /* - // Use up()/down() to run migration code without a transaction. - public function up() - { - - } - - public function down() - { - echo "m180605_082938_alter_table_article cannot be reverted.\n"; - - return false; - } - */ -} diff --git a/console/migrations/m181102_082938_alter_table_article.php b/console/migrations/m181102_082938_alter_table_article.php new file mode 100644 index 0000000..a5dcbe9 --- /dev/null +++ b/console/migrations/m181102_082938_alter_table_article.php @@ -0,0 +1,40 @@ +addColumn('blog_article', 'views', $this->integer()->defaultValue(0)); + } + + /** + * {@inheritdoc} + */ + public function safeDown() + { + $this->dropColumn('blog_article', 'views'); + } + + /* + // Use up()/down() to run migration code without a transaction. + public function up() + { + + } + + public function down() + { + echo "m180605_082938_alter_table_article cannot be reverted.\n"; + + return false; + } + */ +} diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 2884089..cda66de 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -13,14 +13,14 @@ public $baseUrl = '@web'; public $css = [ 'css/style.css', - '//fonts.googleapis.com/css?family=Ubuntu:400,500,700&subset=cyrillic,cyrillic-ext,latin-ext' +// '//fonts.googleapis.com/css?family=Ubuntu:400,500,700&subset=cyrillic,cyrillic-ext,latin-ext' ]; public $js = [ 'js/script.js', 'js/jquery.mask.min.js' ]; public $depends = [ - 'yii\web\JqueryAsset', + 'yii\web\YiiAsset', ]; } \ No newline at end of file diff --git a/frontend/assets/ScrollAsset.php b/frontend/assets/ScrollAsset.php index 194479d..772e14b 100644 --- a/frontend/assets/ScrollAsset.php +++ b/frontend/assets/ScrollAsset.php @@ -22,6 +22,6 @@ class ScrollAsset extends AssetBundle 'js/jquery.mCustomScrollbar.concat.min.js' ]; public $depends = [ - 'yii\web\JqueryAsset', + 'frontend\assets\AppAsset', ]; } \ No newline at end of file diff --git a/frontend/config/main.php b/frontend/config/main.php index 661b57e..8474144 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -381,7 +381,7 @@ ], 'assetsAutoCompress' => [ 'class' => '\skeeks\yii2\assetsAuto\AssetsAutoCompressComponent', - 'enabled' => false, + 'enabled' => true, 'readFileTimeout' => 3, //Time in seconds for reading each asset file @@ -414,11 +414,11 @@ 'jsFileCompressFlaggedComments' => true, //Cut comments during processing js - 'htmlCompress' => true, + 'htmlCompress' => true, //Enable compression html 'noIncludeJsFilesOnPjax' => true, //Do not connect the js files when all pjax requests - 'htmlCompressOptions' => //options for compressing output result + 'htmlCompressOptions' => //options for compressing output result [ 'extra' => false, //use more compact algorithm diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 19e13ac..55dcea5 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -158,7 +158,7 @@ diff --git a/frontend/views/site/index.php b/frontend/views/site/index.php index 4bdde6f..6c1b834 100755 --- a/frontend/views/site/index.php +++ b/frontend/views/site/index.php @@ -17,7 +17,14 @@ \frontend\assets\ScrollAsset::register($this); $js = << 767) { + $('.for-hidden-mob').mCustomScrollbar( + { + autoHideScrollbar: true, + theme: 'minimal' + } + ); + } setTimeout(function() { if ($(".slider-first") .children().length > 1) { diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index 1db6d6d..900f448 100644 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -482,6 +482,9 @@ $(document).ready(function() { }); }); +jQuery.fn.load = function(callback) { + $(window).on("load", callback) +}; window.onload = function () { console.log('start onload'); @@ -499,21 +502,8 @@ window.onload = function () { console.log('start'); $('nav').addClass('start'); $('body').addClass('disabled-preloader') - },2700 + 2000) + },2700 + 2000); - if($(window).width() > 767) { - $('.for-hidden-mob').mCustomScrollbar( - { - autoHideScrollbar: true, - theme: 'minimal' - } - ); - } -} - -$(window).load(function() { - console.log('start load jquery'); - -}); +}; -- libgit2 0.21.4