Thursday, January 26, 2012

Runtime optimized JavaScript and CSS - workaround for multiple stylesheets

Update: This workaround is only needed if you use "folders" in the image resource name.
E.g. backgrounds\home.png.

If you have multiple local stylesheets on a page, the CSS files are combined into a single file.

This changes the url to the stylesheet (adds xsp/.ibmmodres/.css after the path to the db).

If you have an image reference like url(image.png), the image can no longer be loaded, as the url is relative to the path of the stylesheet.

To work around this issue, add ../../../ to the image reference.

E.g.
url(../../../image.png)

2 comments:

Giuseppe Grasso said...

that's strange, on my server images are addressable either as [...]/database.NSF/xsp/.ibmmodres/.css/image.png
or
[...]/database.NSF/image.png

Tommy Valand said...

Seems you are correct. The app I was having problems with used "folders" in the image name. E.g. backgrounds\home.png.

So the workaround is only needed if you use "folders" in the image name.

Thanks for the heads up :)