Commit 241b6fc4 by Qiang Xue

Modified the IAssetConvert interface.

parent 5f23f631
......@@ -135,10 +135,10 @@ class AssetBundle extends Object
$this->publish($view->getAssetManager());
foreach ($this->js as $js) {
$view->registerJsFile($js, $this->jsOptions);
$view->registerJsFile($this->baseUrl . '/' . $js, $this->jsOptions);
}
foreach ($this->css as $css) {
$view->registerCssFile($css, $this->cssOptions);
$view->registerCssFile($this->baseUrl . '/' . $css, $this->cssOptions);
}
}
......
......@@ -34,13 +34,12 @@ class AssetConverter extends Component implements IAssetConverter
* Converts a given asset file into a CSS or JS file.
* @param string $asset the asset file path, relative to $basePath
* @param string $basePath the directory the $asset is relative to.
* @param string $baseUrl the URL corresponding to $basePath
* @return string the URL to the converted asset file.
* @return string the converted asset file path, relative to $basePath.
*/
public function convert($asset, $basePath, $baseUrl)
public function convert($asset, $basePath)
{
$pos = strrpos($asset, '.');
if ($pos !== false) {
if ($pos === false) {
$ext = substr($asset, $pos + 1);
if (isset($this->commands[$ext])) {
list ($ext, $command) = $this->commands[$ext];
......@@ -54,9 +53,9 @@ class AssetConverter extends Component implements IAssetConverter
exec($command, $output);
Yii::info("Converted $asset into $result: " . implode("\n", $output), __METHOD__);
}
return "$baseUrl/$result";
return $result;
}
}
return "$baseUrl/$asset";
return $asset;
}
}
......@@ -19,9 +19,7 @@ interface IAssetConverter
* Converts a given asset file into a CSS or JS file.
* @param string $asset the asset file path, relative to $basePath
* @param string $basePath the directory the $asset is relative to.
* @param string $baseUrl the URL corresponding to $basePath
* @return string the URL to the converted asset file. If the given asset does not
* need conversion, "$baseUrl/$asset" should be returned.
* @return string the converted asset file path, relative to $basePath.
*/
public function convert($asset, $basePath, $baseUrl);
public function convert($asset, $basePath);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment