Commit 4d6ebae3 by Qiang Xue

finished asset.

parent e89a2954
...@@ -179,11 +179,33 @@ can know which extensions are installed (the information can be accessed via [[y ...@@ -179,11 +179,33 @@ can know which extensions are installed (the information can be accessed via [[y
#### Dependencies <a name="dependencies"></a> #### Dependencies <a name="dependencies"></a>
Your extension depends on Yii (of course). So you should list it in the `require` entry in `composer.json`. Your extension depends on Yii (of course). So you should list it (`yiisoft/yii2`) in the `require` entry in `composer.json`.
If your extension also depends on other extensions or third-party libraries, you should list them as well. If your extension also depends on other extensions or third-party libraries, you should list them as well.
Make sure you also list appropriate version constraints (e.g. `1.*`, `@stable`) for each dependency. Use stable Make sure you also list appropriate version constraints (e.g. `1.*`, `@stable`) for each dependent package. Use stable
dependencies when your extension is released in a stable version. dependencies when your extension is released in a stable version.
Most JavaScript/CSS packages are managed using [Bower](http://bower.io/) and/or [NPM](https://www.npmjs.org/),
instead of Composer. Yii uses the [Composer asset plugin](https://github.com/francoispluchino/composer-asset-plugin)
to enable managing these kinds of packages through Composer. If your extension depends on a Bower package, you can
simply list the dependency in `composer.json` like the following:
```json
{
// package dependencies
"require": {
"bower-asset/jquery": ">=1.11.*"
}
}
```
The above code states that the extension depends on the `jquery` Bower package. In general, you can use
`bower-asset/PackageName` to refer to a Bower package in `composer.json`, and use `npm-asset/PackageName`
to refer to a NPM package. When Composer installs a Bower or NPM package, by default the package content will be
installed under the `@vendor/bower/PackageName` and `@vendor/npm/Packages` directories, respectively.
These two directories can also be referred to using the shorter aliases `@bower/PackageName` and `@npm/PackageName`.
For more details about asset management, please refer to the [Assets](structure-assets.md#bower-npm-assets) section.
#### Class Autoloading <a name="class-autoloading"></a> #### Class Autoloading <a name="class-autoloading"></a>
...@@ -298,9 +320,10 @@ two choices to make the asset files directly accessible via Web: ...@@ -298,9 +320,10 @@ two choices to make the asset files directly accessible via Web:
copy the files listed in the asset bundle to a Web-accessible folder. copy the files listed in the asset bundle to a Web-accessible folder.
We recommend you use the second approach so that your extension can be more easily used by other people. We recommend you use the second approach so that your extension can be more easily used by other people.
Please refer to the [Assets] section for more details about how to work with assets in general.
### Internationalization and Localization <a name="i18n-l10n"></a> #### Internationalization and Localization <a name="i18n-l10n"></a>
Your extension may be used by applications supporting different languages! Therefore, if your extension displays Your extension may be used by applications supporting different languages! Therefore, if your extension displays
content to end users, you should try to [internationalize and localize](tutorial-i18n.md) it. In particular, content to end users, you should try to [internationalize and localize](tutorial-i18n.md) it. In particular,
......
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