neilime / zf2-assets-bundle

AssetsBundle is a module for Zend Framework 2 allowing asset managment (bundling & caching)
https://neilime.github.io/zf2-assets-bundle/
MIT License
33 stars 20 forks source link

Including Boostrap less file generate absolute URLs #59

Open wambaloo opened 7 years ago

wambaloo commented 7 years ago

Hi !

I just found that including less bootstrap file generate absolute URLs for fonts. It cause glyphicon crash and not displayed. I write a workaround in my local files but I really don't know if it's a real bug or if it's a configuration to do.

In my AssetsFileManager.php, line 208, I added these lines:

/* HACK LPO TO REPLACE ABSOLUTE URLS BY RELATIVES URL */
        $regexRelativeUrl = "/(url\(')(C:)?[a-zA-Z0-9\/]*(\/bootstrap\/less\/fonts)/i";
        if (preg_match_all($regexRelativeUrl, $sAssetFileFilteredContent, $matches)) {
            $replace = array_unique($matches[0]);
            foreach ($replace as $search) {
                $sAssetFileFilteredContent = str_replace($search, "url('../fonts", $sAssetFileFilteredContent);
            }
        }
        /* END HACK */