Tuesday, January 31, 2012

Re: does CSS Sprite is default ?

If you use gwt client bundle for referencing your images in your gwt app, gwt compiler will decide how is best way of "storing" the images.

By default, it stores small images in with the content embedded in the urls, like: <img src="data:101010010100110". For bigger images, it store them as regular files and regular urls, like src="afile1.png"

In client bundles you can force the gwt compiler to a technic. For example, if I don't want the compiler to "inline" the data image in urls I annotate the ImageResource with @ImageOptions(preventInlining=true) as the following code shows.

import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ClientBundle;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;

public interface TestImageResources extends ClientBundle {
TestImageResources INSTANCE = GWT.create(TestImageResources.class);

@ImageOptions(preventInlining=true)
@Source("smallLion.png")
ImageResource smallLion();

}

regards,


On Mon, 30 Jan 2012 18:56:10 -0800 (PST)
wahaha <ilcll@yahoo.com.cn> wrote:

> there has many small pictures in a page,does GWT will merge them by
> default?
>
> --
> You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
> To post to this group, send email to google-web-toolkit@googlegroups.com.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
>


--
Sebastian Gurin <sgurin@softpoint.org>

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment