diff --git a/yii/web/AssetBundle.php b/yii/web/AssetBundle.php index 37577dd..daa533f 100644 --- a/yii/web/AssetBundle.php +++ b/yii/web/AssetBundle.php @@ -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); } } diff --git a/yii/web/AssetConverter.php b/yii/web/AssetConverter.php index 4fde1fc..cfad360 100644 --- a/yii/web/AssetConverter.php +++ b/yii/web/AssetConverter.php @@ -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; } } diff --git a/yii/web/IAssetConverter.php b/yii/web/IAssetConverter.php index d1d1da0..6021963 100644 --- a/yii/web/IAssetConverter.php +++ b/yii/web/IAssetConverter.php @@ -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); }