Sunday, April 7, 2013

Re: How to use images in CSS ClientBundle?

Do you want to bundle images into your JS file or do you really want the images to be loaded externally?

In the first case you have to use ImageResource inside your ClientBundle so that images will be bundled into your JS file. Read the chapters ImageResource and CssResource -> Image Sprites: https://developers.google.com/web-toolkit/doc/latest/DevGuideClientBundle

If you really want the image externally then you have to either put them directly into your war folder (or any subfolder of course) or create a folder called "public" next to your App.gwt.xml and put them into that folder. When you compile your app (or during DevMode) everything in the public folder will end up in your war/<modulename> folder automatically. After you have done this you have to correct your image urls inside your CSS code. Your Css will be injected directly into your host HTML page, so all urls should be relative to that location. E.g. if you put your images into war/images and your host HTML page is war/index.html then your CSS should use "url('images/ok.png')".

-- J.


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

No comments:

Post a Comment