framework/web/AssetBundle.php
public function publish($am)
    {
        if ($this->sourcePath !== null && !isset($this->basePath, $this->baseUrl)) {
            list($this->basePath, $this->baseUrl) = $am->publish($this->sourcePath, $this->publishOptions);
        }

        if (isset($this->basePath, $this->baseUrl) && ($converter = $am->getConverter()) !== null) {
            foreach ($this->js as $i => $js) {
                if (is_array($js)) {
                    $file = array_shift($js);
                    if (Url::isRelative($file)) {
                        $js = ArrayHelper::merge($this->jsOptions, $js);
                        array_unshift($js, $converter->convert($file, $this->basePath));
                        $this->js[$i] = $js;
                    }
                } elseif (Url::isRelative($js)) {
                    $this->js[$i] = $converter->convert($js, $this->basePath);
                }
            }
            foreach ($this->css as $i => $css) {
                if (is_array($css)) {
                    $file = array_shift($css);
                    if (Url::isRelative($file)) {
                        $css = ArrayHelper::merge($this->cssOptions, $css);
                        array_unshift($css, $converter->convert($file, $this->basePath));
                        $this->css[$i] = $css;
                    }
                } elseif (Url::isRelative($css)) {
                    $this->css[$i] = $converter->convert($css, $this->basePath);
                }
            }
        }
    }
public function publish($am)
    {
        if ($this->sourcePath !== null && !isset($this->basePath, $this->baseUrl)) {
            list($this->basePath, $this->baseUrl) = $am->publish($this->sourcePath, $this->publishOptions);
        }

        if (isset($this->basePath, $this->baseUrl) && ($converter = $am->getConverter()) !== null) {
            foreach ($this->js as $i => $js) {
                if (is_array($js)) {
                    $file = array_shift($js);
                    if (Url::isRelative($file)) {
                        $js = ArrayHelper::merge($this->jsOptions, $js);
                        array_unshift($js, $converter->convert($file, $this->basePath));
                        $this->js[$i] = $js;
                    }
                } elseif (Url::isRelative($js)) {
                    $this->js[$i] = $converter->convert($js, $this->basePath);
                }
            }
            foreach ($this->css as $i => $css) {
                if (is_array($css)) {
                    $file = array_shift($css);
                    if (Url::isRelative($file)) {
                        $css = ArrayHelper::merge($this->cssOptions, $css);
                        array_unshift($css, $converter->convert($file, $this->basePath));
                        $this->css[$i] = $css;
                    }
                } elseif (Url::isRelative($css)) {
                    $this->css[$i] = $converter->convert($css, $this->basePath);
                }
            }
        }
    }
public function publish ( $ am ) { if ( $ this -> sourcePath !== null && ! isset ( $ this -> basePath , $ this -> baseUrl ) ) { list ( $ this -> basePath , $ this -> baseUrl ) = $ am -> publish ( $ this -> sourcePath , $ this -> publishOptions ) ; } if ( isset ( $ this -> basePath , $ this -> baseUrl ) && ( $ converter = $ am -> getConverter ( ) ) !== null ) { foreach ( $ this -> js as $ i => $ js ) { if ( is_array ( $ js ) ) { $ file = array_shift ( $ js ) ; if ( Url :: isRelative ( $ file ) ) { $ js = ArrayHelper :: merge ( $ this -> jsOptions , $ js ) ; array_unshift ( $ js , $ converter -> convert ( $ file , $ this -> basePath ) ) ; $ this -> js [ $ i ] = $ js ; } } elseif ( Url :: isRelative ( $ js ) ) { $ this -> js [ $ i ] = $ converter -> convert ( $ js , $ this -> basePath ) ; } } foreach ( $ this -> css as $ i => $ css ) { if ( is_array ( $ css ) ) { $ file = array_shift ( $ css ) ; if ( Url :: isRelative ( $ file ) ) { $ css = ArrayHelper :: merge ( $ this -> cssOptions , $ css ) ; array_unshift ( $ css , $ converter -> convert ( $ file , $ this -> basePath ) ) ; $ this -> css [ $ i ] = $ css ; } } elseif ( Url :: isRelative ( $ css ) ) { $ this -> css [ $ i ] = $ converter -> convert ( $ css , $ this -> basePath ) ; } } } }
Publishes the asset bundle if its source code is not under Web-accessible directory.
It will also try to convert non-CSS or JS files (e.g. LESS, Sass) into the corresponding
CSS or JS files using [[AssetManager::converter|asset converter]].
@param AssetManager $am the asset manager to perform the asset publishing
Publishes the asset bundle if its source code is not under Web - accessible directory . It will also try to convert non - CSS or JS files ( e . g . LESS Sass ) into the corresponding CSS or JS files using [[ AssetManager :: converter|asset converter ]] .