Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
4d6ebae3
Commit
4d6ebae3
authored
Sep 25, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
finished asset.
parent
e89a2954
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
structure-assets.md
docs/guide/structure-assets.md
+0
-0
structure-extensions.md
docs/guide/structure-extensions.md
+26
-3
No files found.
docs/guide/structure-assets.md
View file @
4d6ebae3
This diff is collapsed.
Click to expand it.
docs/guide/structure-extensions.md
View file @
4d6ebae3
...
@@ -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 dependen
cy
. Use stable
Make sure you also list appropriate version constraints (e.g.
`1.*`
,
`@stable`
) for each dependen
t 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,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment