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

Error while replacing url relative pathname in CSS. #19

Closed xrorox closed 7 years ago

xrorox commented 10 years ago

Hi,

The assets bundle use absolute pathnames when replacing url(..) relative paths in CSS files. For exemple, in bootstrap 3 url('../fonts') become url('/cache/fonts').

This works well in most case. But when you are using "server30/application/" as root url, it is impossible for Bootstrap 3 to load the font files.

One working solution in this particular case is to modify the rewriteUrl function in AssetBundleService. I replaced the call to $this->getOptions()->getCacheUrl() by './' on line 832.

So the url is replaced by a relative url, inside cache directory. I hadn't get any drawnbacks yet, but I do not know the other uses of this method.

It works for me with both root url ( "application_name" or "server/application_name").

neilime commented 10 years ago

You know you can define your own cache url with the option named cacheUrl. If this does not help you Please post here your assets_bundle config.