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
cc351d06
Commit
cc351d06
authored
Jun 25, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tip about environment related asset config
fixes #3324
parent
a03d87fe
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
3 deletions
+13
-3
output-client-scripts.md
docs/guide/output-client-scripts.md
+3
-3
structure-assets.md
docs/guide/structure-assets.md
+10
-0
No files found.
docs/guide/output-client-scripts.md
View file @
cc351d06
...
...
@@ -40,13 +40,13 @@ will be added AFTER `jquery.js`. Without this dependency specification, the rela
`main.js`
and
`jquery.js`
would be undefined.
Like for
[
[yii\web\View::registerCssFile()|registerCssFile()
]
], it is also highly recommended that you use
[
asset bundles
](
assets.md
)
to register external JS files rather than using
[
[yii\web\View::registerJsFile()|registerJsFile()
]
].
[
asset bundles
](
structure-
assets.md
)
to register external JS files rather than using
[
[yii\web\View::registerJsFile()|registerJsFile()
]
].
### Registering asset bundles
As was mentioned earlier it's preferred to use asset bundles instead of using CSS and JavaScript directly. You can get
details on how to define asset bundles in
[
asset manager
](
assets.md
)
section of the guide. As for using already defined
details on how to define asset bundles in
[
asset manager
](
structure-
assets.md
)
section of the guide. As for using already defined
asset bundle, it's very straightforward:
```
php
...
...
@@ -90,6 +90,6 @@ The code above will add a link to CSS file to the head section of the page.
used instead.
It is highly recommended that you use
[
asset bundles
](
assets.md
)
to register external CSS files rather than
It is highly recommended that you use
[
asset bundles
](
structure-
assets.md
)
to register external CSS files rather than
using
[
[yii\web\View::registerCssFile()|registerCssFile()
]
]. Using asset bundles allows you to combine and compress
multiple CSS files, which is desirable for high traffic websites.
docs/guide/structure-assets.md
View file @
cc351d06
...
...
@@ -165,6 +165,16 @@ and corresponding values to set.
Setting
`sourcePath`
to
`null`
tells asset manager not to copy anything while
`js`
overrides local files with a link
to CDN.
> Tip: You may also use this procedure to configure different scripts dependent on the environment. For example
> use minified files in production and normal files in development:
>
> ```php
'yii
\w
eb
\J
queryAsset' =>
[
'js' =>
[
YII_ENV_DEV ? 'jquery.js' : 'jquery.min.js'
]
],
```
Enabling symlinks
-----------------
...
...
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