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
82535b25
Commit
82535b25
authored
Apr 17, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
8f9cfa2c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
AssetBundle.php
framework/web/AssetBundle.php
+19
-14
No files found.
framework/web/AssetBundle.php
View file @
82535b25
...
@@ -17,14 +17,21 @@ use yii\base\Object;
...
@@ -17,14 +17,21 @@ use yii\base\Object;
class
AssetBundle
extends
Object
class
AssetBundle
extends
Object
{
{
/**
/**
* @var string the root directory of the asset files. If this is not set,
* @var string the root directory of the source asset files. If this is set,
* the assets are considered to be located under a Web-accessible folder already
* the source asset files will be published to [[basePath]] when the bundle
* and no asset publishing will be performed.
* is being used the first time.
*/
public
$sourcePath
;
/**
* @var string the root directory of the public asset files. If this is not set
* while [[sourcePath]] is set, a default value will be set by [[AssetManager]]
* when it publishes the source asset files. If you set this property, please
* make sure the directory is Web accessible.
*/
*/
public
$basePath
;
public
$basePath
;
/**
/**
* @var string the base URL that will be prefixed to the asset files.
* @var string the base URL that will be prefixed to the asset files.
* This property must be set if
[[basePath]] is not set
.
* This property must be set if
you set [[basePath]] explicitly
.
* When this property is not set, it will be initialized as the base URL
* When this property is not set, it will be initialized as the base URL
* that the assets are published to.
* that the assets are published to.
*/
*/
...
@@ -33,12 +40,11 @@ class AssetBundle extends Object
...
@@ -33,12 +40,11 @@ class AssetBundle extends Object
* @var array list of JavaScript files that this bundle contains. Each JavaScript file can
* @var array list of JavaScript files that this bundle contains. Each JavaScript file can
* be specified in one of the three formats:
* be specified in one of the three formats:
*
*
* - a relative path: a path relative to [[basePath]] if [[basePath]] is set,
* - a relative file path: a path relative to [[basePath]];,
* or a URL relative to [[baseUrl]] if [[basePath]] is not set;
* - an absolute URL;
* - an absolute URL;
* - a path alias that can be resolved into a relative path or an absolute URL.
* - a path alias that can be resolved into a relative path or an absolute URL.
*
*
* Note that
you should not use backward slashes "\" to specify JavaScript file
s.
* Note that
only forward slashes "/" should be used as directory separator
s.
*
*
* Each JavaScript file may be associated with options. In this case, the array key
* Each JavaScript file may be associated with options. In this case, the array key
* should be the JavaScript file path, while the corresponding array value should
* should be the JavaScript file path, while the corresponding array value should
...
@@ -49,12 +55,11 @@ class AssetBundle extends Object
...
@@ -49,12 +55,11 @@ class AssetBundle extends Object
* @var array list of CSS files that this bundle contains. Each CSS file can
* @var array list of CSS files that this bundle contains. Each CSS file can
* be specified in one of the three formats:
* be specified in one of the three formats:
*
*
* - a relative path: a path relative to [[basePath]] if [[basePath]] is set,
* - a relative file path: a path relative to [[basePath]];,
* or a URL relative to [[baseUrl]] if [[basePath]] is not set;
* - an absolute URL;
* - an absolute URL;
* - a path alias that can be resolved into a relative path or an absolute URL.
* - a path alias that can be resolved into a relative path or an absolute URL.
*
*
* Note that
you should not use backward slashes "\" to specify CSS file
s.
* Note that
only forward slashes "/" should be used as directory separator
s.
*
*
* Each CSS file may be associated with options. In this case, the array key
* Each CSS file may be associated with options. In this case, the array key
* should be the CSS file path, while the corresponding array value should
* should be the CSS file path, while the corresponding array value should
...
@@ -71,8 +76,8 @@ class AssetBundle extends Object
...
@@ -71,8 +76,8 @@ class AssetBundle extends Object
if
(
$this
->
baseUrl
!==
null
)
{
if
(
$this
->
baseUrl
!==
null
)
{
$this
->
baseUrl
=
rtrim
(
Yii
::
getAlias
(
$this
->
baseUrl
),
'/'
);
$this
->
baseUrl
=
rtrim
(
Yii
::
getAlias
(
$this
->
baseUrl
),
'/'
);
}
}
if
(
$this
->
bas
ePath
!==
null
)
{
if
(
$this
->
sourc
ePath
!==
null
)
{
$this
->
basePath
=
rtrim
(
Yii
::
getAlias
(
$this
->
bas
ePath
),
'/\\'
);
$this
->
sourcePath
=
rtrim
(
Yii
::
getAlias
(
$this
->
sourc
ePath
),
'/\\'
);
}
}
}
}
...
@@ -105,8 +110,8 @@ class AssetBundle extends Object
...
@@ -105,8 +110,8 @@ class AssetBundle extends Object
*/
*/
public
function
publish
(
$assetManager
)
public
function
publish
(
$assetManager
)
{
{
if
(
$this
->
bas
ePath
!==
null
)
{
if
(
$this
->
sourc
ePath
!==
null
)
{
$baseUrl
=
$assetManager
->
publish
(
$this
->
bas
ePath
);
$baseUrl
=
$assetManager
->
publish
(
$this
->
sourc
ePath
);
if
(
$this
->
baseUrl
===
null
)
{
if
(
$this
->
baseUrl
===
null
)
{
$this
->
baseUrl
=
$baseUrl
;
$this
->
baseUrl
=
$baseUrl
;
}
}
...
...
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