Commit aee25c24 by Alexander Makarov

Fixes #728

parent 8402cafa
...@@ -62,6 +62,26 @@ Additionally you may specify `$jsOptions`, `$cssOptions` and `$publishOptions` t ...@@ -62,6 +62,26 @@ Additionally you may specify `$jsOptions`, `$cssOptions` and `$publishOptions` t
[[yii\web\View::registerJsFile()]], [[yii\web\View::registerCssFile()]] and [[yii\web\AssetManager::publish()]] [[yii\web\View::registerJsFile()]], [[yii\web\View::registerCssFile()]] and [[yii\web\AssetManager::publish()]]
respectively during registering and publising an asset. respectively during registering and publising an asset.
### Language-specific asset bundle
If you need to define an asset bundle that includes JavaScript file depending on the language you can do it the
following way:
```php
class LanguageAsset extends AssetBundle
{
public $sourcePath = '@app/assets/language';
public $js = [
];
public function init()
{
$this->js[] = 'language-' . Yii::$app->language . '.js';
parent::init();
}
}
```
Registering asset bundle Registering asset bundle
------------------------ ------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment