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
1f47ea97
Commit
1f47ea97
authored
Apr 18, 2013
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added asset processor concept.
parent
d22e8ea3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
1 deletion
+16
-1
AssetManager.php
framework/web/AssetManager.php
+16
-1
No files found.
framework/web/AssetManager.php
View file @
1f47ea97
...
...
@@ -26,6 +26,13 @@ class AssetManager extends Component
*/
public
$bundles
;
/**
* @var array list of asset processors. An asset processor will convert a special type of asset files
* (e.g. LESS, Sass, TypeScript) into JS or CSS files. The array keys are the file extension names
* (e.g. "less", "sass", "ts"), and the array values are the corresponding configuration arrays
* for creating the processor objects.
*/
public
$processors
;
/**
* @return string the root directory storing the published asset files.
*/
public
$basePath
=
'@wwwroot/assets'
;
...
...
@@ -143,7 +150,15 @@ class AssetManager extends Component
*/
public
function
processAsset
(
$asset
,
$basePath
,
$baseUrl
)
{
return
$baseUrl
.
'/'
.
$asset
;
$ext
=
pathinfo
(
$asset
,
PATHINFO_EXTENSION
);
if
(
isset
(
$this
->
processors
[
$ext
]))
{
if
(
is_array
(
$this
->
processors
[
$ext
]))
{
$this
->
processors
[
$ext
]
=
Yii
::
createObject
(
$this
->
processors
[
$ext
]);
}
return
$this
->
processors
[
$ext
]
->
process
(
$asset
,
$basePath
,
$baseUrl
);
}
else
{
return
$baseUrl
.
'/'
.
$asset
;
}
}
/**
...
...
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