diff --git a/docs/guide/structure-assets.md b/docs/guide/structure-assets.md index 3b4c030..a4a2659 100644 --- a/docs/guide/structure-assets.md +++ b/docs/guide/structure-assets.md @@ -51,7 +51,7 @@ class AppAsset extends AssetBundle ``` The above `AppAsset` class specifies that the asset files are located under the `@webroot` directory which -is corresponding to the URL `@web`; the bundle contains a single CSS file `css/site.css` and no JavaScript file; +corresponds to the URL `@web`; the bundle contains a single CSS file `css/site.css` and no JavaScript file; the bundle depends on two other bundles: [[yii\web\YiiAsset]] and [[yii\bootstrap\BootstrapAsset]]. More detailed explanation about the properties of [[yii\web\AssetBundle]] can be found in the following: @@ -104,7 +104,7 @@ Assets, based on their location, can be classified as: When defining an asset bundle class, if you specify the [[yii\web\AssetBundle::sourcePath|sourcePath]] property, it means any assets listed using relative paths will be considered as source assets. If you do not specify this property, it means those assets are published assets (you should therefore specify [[yii\web\AssetBundle::basePath|basePath]] and -[[yii\web\AssetBundle::baseUrl|baseUrl]] to let Yii know where they are located.) +[[yii\web\AssetBundle::baseUrl|baseUrl]] to let Yii know where they are located). It is recommended that you place assets belonging to an application in a Web directory to avoid the unnecessary asset publishing process. This is why `AppAsset` in the prior example specifies [[yii\web\AssetBundle::basePath|basePath]] @@ -116,13 +116,13 @@ property when defining asset bundle classes for them. > Note: Do not use `@webroot/assets` as the [[yii\web\AssetBundle::sourcePath|source path]]. This directory is used by default by the [[yii\web\AssetManager|asset manager]] to save the asset files - published from their source location. Any content in this directory are considered temporarily and may be subject + published from their source location. Any content in this directory is considered temporarily and may be subject to removal. ### Asset Dependencies -When you include multiple CSS or JavaScript files in a Web page, they have to follow certain orders to avoid +When you include multiple CSS or JavaScript files in a Web page, they have to follow a certain order to avoid overriding issues. For example, if you are using a jQuery UI widget in a Web page, you have to make sure the jQuery JavaScript file is included before the jQuery UI JavaScript file. We call such ordering the dependencies among assets. @@ -208,7 +208,7 @@ the `beforeCopy` publishing option, only the `fonts` and `css` subdirectories wi ### Bower and NPM Assets -Most JavaScript/CSS package are managed by [Bower](http://bower.io/) and/or [NPM](https://www.npmjs.org/). +Most JavaScript/CSS packages are managed by [Bower](http://bower.io/) and/or [NPM](https://www.npmjs.org/). If your application or extension is using such a package, it is recommended that you follow these steps to manage the assets in the library: @@ -240,9 +240,9 @@ AppAsset::register($this); // $this represents the view object If you are registering an asset bundle in other places, you should provide the needed view object. For example, to register an asset bundle in a [widget](structure-widgets.md) class, you can get the view object by `$this->view`. -When an asset bundle is registered with a view, behind the scene Yii will register all its dependent asset bundles. +When an asset bundle is registered with a view, behind the scenes Yii will register all its dependent asset bundles. And if an asset bundle is located in a directory inaccessible through the Web, it will be published to a Web directory. -Later when the view renders a page, it will generate `` and `