src/Template/Extension/Asset.php
public function cachedAssetUrl($url)
    {
        $filePath = $this->path . '/' . \ltrim($url, '/');

        if (!\file_exists($filePath)) {
            throw new \LogicException(
                'Unable to locate the asset "' . $url . '" in the "' . $this->path . '" directory.'
            );
        }

        $lastUpdated = \filemtime($filePath);
        $pathInfo = \pathinfo($url);

        if ($pathInfo['dirname'] === '.') {
            $directory = '';
        } elseif ($pathInfo['dirname'] === '/') {
            $directory = '/';
        } else {
            $directory = $pathInfo['dirname'] . '/';
        }

        if ($this->filenameMethod) {
            return $directory . $pathInfo['filename'] . '.' . $lastUpdated . '.' . $pathInfo['extension'];
        }

        return $directory . $pathInfo['filename'] . '.' . $pathInfo['extension'] . '?v=' . $lastUpdated;
    }
public function cachedAssetUrl($url)
    {
        $filePath = $this->path . '/' . \ltrim($url, '/');

        if (!\file_exists($filePath)) {
            throw new \LogicException(
                'Unable to locate the asset "' . $url . '" in the "' . $this->path . '" directory.'
            );
        }

        $lastUpdated = \filemtime($filePath);
        $pathInfo = \pathinfo($url);

        if ($pathInfo['dirname'] === '.') {
            $directory = '';
        } elseif ($pathInfo['dirname'] === '/') {
            $directory = '/';
        } else {
            $directory = $pathInfo['dirname'] . '/';
        }

        if ($this->filenameMethod) {
            return $directory . $pathInfo['filename'] . '.' . $lastUpdated . '.' . $pathInfo['extension'];
        }

        return $directory . $pathInfo['filename'] . '.' . $pathInfo['extension'] . '?v=' . $lastUpdated;
    }
public function cachedAssetUrl ( $ url ) { $ filePath = $ this -> path . '/' . \ ltrim ( $ url , '/' ) ; if ( ! \ file_exists ( $ filePath ) ) { throw new \ LogicException ( 'Unable to locate the asset "' . $ url . '" in the "' . $ this -> path . '" directory.' ) ; } $ lastUpdated = \ filemtime ( $ filePath ) ; $ pathInfo = \ pathinfo ( $ url ) ; if ( $ pathInfo [ 'dirname' ] === '.' ) { $ directory = '' ; } elseif ( $ pathInfo [ 'dirname' ] === '/' ) { $ directory = '/' ; } else { $ directory = $ pathInfo [ 'dirname' ] . '/' ; } if ( $ this -> filenameMethod ) { return $ directory . $ pathInfo [ 'filename' ] . '.' . $ lastUpdated . '.' . $ pathInfo [ 'extension' ] ; } return $ directory . $ pathInfo [ 'filename' ] . '.' . $ pathInfo [ 'extension' ] . '?v=' . $ lastUpdated ; }
Create "cache busted" asset URL.

@param  string $url

@return string
Create cache busted asset URL .