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
8d0cac8c
Commit
8d0cac8c
authored
Nov 12, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #5220
parent
b7012ca9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
structure-assets.md
docs/guide/structure-assets.md
+33
-1
No files found.
docs/guide/structure-assets.md
View file @
8d0cac8c
...
...
@@ -160,7 +160,7 @@ This will cause a CSS file in the bundle to be included using the following HTML
<![endif]-->
```
To wrap
link tag with
`<noscript>`
the following can be used:
To wrap
the generated CSS link tags within
`<noscript>`
, you can configure
`cssOptions`
as follows,
```
php
public
$cssOptions
=
[
'noscript'
=>
true
];
...
...
@@ -173,6 +173,38 @@ of the body section), use the following option:
public
$jsOptions
=
[
'position'
=>
\yii\web\View
::
POS_HEAD
];
```
By default, when an asset bundle is being published, all contents in the directory specified by
[
[yii\web\AssetBundle::sourcePath
]
]
will be published. You can customize this behavior by configuring the
[
[yii\web\AssetBundle::publishOptions|publishOptions
]
]
property. For example, to publish only one or a few subdirectories of
[
[yii\web\AssetBundle::sourcePath
]
],
you can do the following in the asset bundle class:
```
php
<?php
namespace
app\assets
;
use
yii\web\AssetBundle
;
class
FontAwesomeAsset
extends
AssetBundle
{
public
$sourcePath
=
'@bower/font-awesome'
;
public
$css
=
[
'css/font-awesome.min.css'
,
];
public
function
init
()
{
parent
::
init
();
$this
->
publishOptions
[
'beforeCopy'
]
=
function
(
$from
,
$to
)
{
$dirname
=
basename
(
dirname
(
$from
));
return
$dirname
===
'fonts'
||
$dirname
===
'css'
;
};
}
}
```
The above example defines an asset bundle for the
[
"fontawesome" package
](
http://fontawesome.io/
)
. By specifying
the
`beforeCopy`
publishing option, only the
`fonts`
and
`css`
subdirectories will be published.
### Bower and NPM Assets <a name="bower-npm-assets"></a>
...
...
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