image sprite in uibinder not working

34 views
Skip to first unread message

asianCoolz

unread,
Dec 27, 2010, 9:08:34 PM12/27/10
to Google Web Toolkit
<ui:image field='logo' src='logo.png'/>
@sprite .logo {
gwt-image: 'logo';
position: absolute;
}
div class='{style.logo}'/> <div class='{style.logo}'/>

when i run my app, i can see in firebug.

image: url("data:image/
png;base64,iVBORw0KGgoAAAANSUhEUgAAAIwAAABLCAYAAACiLW8yAAAn4klEQVR42u19B1hUVxctMdEkRn
+Nv0aNRqMmxgoKImWAoQqKgooFsSs2sDeUiB2jMXZR7CJ2RSyh2EBUe..etc


arent it suppose to combined all <ui:image field='logo' src='logo.png'/
><ui:image field='logo2' src='logo2.png'/> into one big image rather
than encode it into stream like above?

Matthew Hill

unread,
Dec 27, 2010, 10:10:27 PM12/27/10
to google-we...@googlegroups.com
No, that's the default behavior for all browsers which support data URIs. The sprite image method is used in IE <8

asianCoolz

unread,
Dec 27, 2010, 10:45:02 PM12/27/10
to Google Web Toolkit
@Matthew, thank for the update, arent sprite image (combine multiple
images into 1) is faster if we need to reuse example div
class='{style.logo}'/> <div class='{style.logo}'/> ? no way to
set in @sprite parameter to change to this?

Matthew Hill

unread,
Dec 27, 2010, 11:16:42 PM12/27/10
to google-we...@googlegroups.com
The base64 encoded string is only stored once within your compiled JS file - so reuse makes no difference.

There is a way to force it to use sprites, but I've never used it and don't know how to do it. Maybe someone else knows.

asianCoolz

unread,
Dec 27, 2010, 11:52:51 PM12/27/10
to Google Web Toolkit
yes, i agreed stored in base64 . but let say ur same js page is
refresh each time, the page will need to "re-read" the encoded string
from the server right? aren't using sprites is better, as it exist
locally on user browsers cache and when reuse, just re-read from it?
someone please advice on this. which way is better?

Matthew Hill

unread,
Dec 28, 2010, 12:04:29 AM12/28/10
to google-we...@googlegroups.com
The string is stored in the permutation cache.html file which contains all of the javascript. This file is cached - so it isn't re-downloaded on every request from the same browser.

Nirmal Patel

unread,
Dec 28, 2010, 12:34:46 AM12/28/10
to google-we...@googlegroups.com
You can disable inline data urls by following:
<set-property name="ClientBundle.enableInlining" value="false">

Even I havent used it personally; think inlining best serves nby saving a http request to get your image.

Regards,
Nirmal
Reply all
Reply to author
Forward
0 new messages