diff --git a/.htaccess b/.htaccess index f33f784..ca9eb72 100755 --- a/.htaccess +++ b/.htaccess @@ -222,6 +222,11 @@ RewriteRule ^(.*)$ $1.gz [QSA,L] +# сжатие text, html, javascript, css, xml: + +AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript + + #Запрет отдачи HTTP-заголовков Vary браузерам семейства MSIE BrowserMatch "MSIE" force-no-vary diff --git a/frontend/assets/AppAsset.php b/frontend/assets/AppAsset.php index 2ec62a7..3dc1329 100755 --- a/frontend/assets/AppAsset.php +++ b/frontend/assets/AppAsset.php @@ -19,8 +19,8 @@ class AppAsset extends AssetBundle public $baseUrl = '@web'; public $css = [ 'css/css_header.css', - 'css/comments.css', - 'http://fonts.googleapis.com/css?family=Roboto:400,300,700&subset=latin,cyrillic-ext', +// 'css/comments.css', +// 'http://fonts.googleapis.com/css?family=Roboto:400,300,700&subset=latin,cyrillic-ext', ]; public $js = [ diff --git a/frontend/assets/CSSAsset.php b/frontend/assets/CSSAsset.php new file mode 100644 index 0000000..40a5abb --- /dev/null +++ b/frontend/assets/CSSAsset.php @@ -0,0 +1,30 @@ + + * @since 2.0 + */ + class CssAsset extends AssetBundle + { + public $basePath = '@webroot'; + public $baseUrl = '@web'; + public $css = [ + 'css/comments.css', + 'http://fonts.googleapis.com/css?family=Roboto:400,300,700&subset=latin,cyrillic-ext', + ]; + } diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 7329b89..b952dbe 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -12,6 +12,7 @@ use yii\widgets\Breadcrumbs; use frontend\widgets\Seo; use common\models\Event; + use frontend\widgets\AssetWidget; AppAsset::register($this); ?> @@ -249,20 +250,25 @@ foreach($links as $index => $link) { if(is_array($link)) { $links[$index]['itemprop'] = 'url'; - $links[$index]['label'] = ''.$links[$index]['label'].''; + $links[$index]['label'] = ''.$links[$index]['label'].''; } } } echo Breadcrumbs::widget([ + 'options' => [ + 'class' => 'breadcrumb', + 'itemscope' => "", + 'itemtype' => " http://schema.org/BreadcrumbList" + ], 'encodeLabels' => false, - 'itemTemplate' => "
  • {link}
  • \n", + 'itemTemplate' => "
  • {link}
  • \n", 'links' => isset($links) ? $links : [], 'homeLink' => [ - 'label' => 'Интернет-магазин светильников', + 'label' => 'Интернет-магазин светильников', 'url' => Url::to([ '/' ]), 'itemprop' => 'url', ], - 'activeItemTemplate' => '
  • {link}
  • ', + 'activeItemTemplate' => '
  • {link}
  • ', ]) ?> @@ -609,8 +615,34 @@ - - + + [ + 'all', + 'sersid\owlcarousel\Asset', + ], + ] + ); + + echo AssetWidget::widget( + [ + 'assets' => [ + 'all', + 'frontend\assets\CssAsset', + ], + ] + ); + echo AssetWidget::widget( + [ + 'assets' => [ + 'all', + 'frontend\assets\FlipclockAsset', + ], + ] + ); + ?> endBody() ?> diff --git a/frontend/widgets/AssetWidget.php b/frontend/widgets/AssetWidget.php new file mode 100644 index 0000000..22c136e --- /dev/null +++ b/frontend/widgets/AssetWidget.php @@ -0,0 +1,48 @@ +assets) && !is_array($this->assets)) { + throw new InvalidConfigException('Assets must be an array'); + } + } + + public function run() + { + if(!empty($this->assets)) { + $assets = $this->assets; + $bundles = $this->view->assetBundles; + foreach ($assets as $asset) { + if(array_key_exists($asset, $bundles)) { + /** + * @var AssetBundle $bundle + */ + $bundle = $bundles[$asset]; + foreach ($bundle->css as $item) { + echo Html::cssFile($item); + } + $bundle->css = []; + } + } + } + } + } + \ No newline at end of file -- libgit2 0.21.4