neilime/zf2-assets-bundle

Error while replacing url relative pathname in CSS.

xrorox opened this issue · 1 comments

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").

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.