public static function resolveUrl(AssetInterface $asset, $url)
    {
        // given URL is absolute URL
        if (false !== strpos($url, '://')) {
            return $url;
        }

        // source directory of the asset
        $root = dirname($asset->getSourceRoot().'/'.$asset->getTargetPath());

        // path directory where asset is being copied
        $path = dirname($asset->getTargetPath());

        if ('.' === $path) {
            $image = $url;
        } else {
            $image = $path.'/'.$url;
        }

        if (null !== $root) {
            $image = $root.'/'.$url;
        }

        // cleanup local URLs
        if (false === strpos($image, '://')) {
            $image = self::removeQueryString($image);
            $image = self::removeAnchor($image);

            return self::resolveUps($image);
        }

        return $image;
    }