Saturday, June 26, 2010

Re: Flash of Unstyled Content

On 26 juin, 10:12, Kris <krisajenk...@gmail.com> wrote:
> Thanks Stefan. :-)
>
> Yes, sorry - I typed that code it when I should have copied and pasted
> - it would have been clearer. Here's the whole of my module:
>
> public class FrontPage implements EntryPoint {
>         private static final FrontPageClientBundle clientBundle =
> GWT.create( FrontPageClientBundle.class );
>
>         public void onModuleLoad() {
>
> StyleInjector.injectAtStart( clientBundle.style().getText(), true );
>         }
>
> }
>
> I actually don't have any GWT widgets - at least not yet. I just want
> to take advantage of GWT's spriting & hashing to begin with, to speed
> up the load of an existing page. And it works *really* well, except
> for the brief flash at the beginning where the page renders once
> without any style information. That's the problem I'm trying to solve.
>
> Any ideas?

As good as GWT ClientBundle is, it's not meant to solve your issue
(styling an HTML page). If I were you, I'd either:
- rather use other CSS tooling (http://sass-lang.com/ or http://lesscss.org/
for instance, and/or http://spriteme.org/ )
- if you want to stick with GWT's ClientBundle, create your own
Linker (inspired by XSLinker if I were you) to (try to) load the
stylesheet "synchronously", without waiting for the onload/
DOMContentLoad event.

But really I find it weird to use JavaScript to control "plain old
styling", so I'd rather go the first way, i.e. using the right tool
for the job.

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate