On Apr 1, 1:22 am, Dustin Whittle <[EMAIL PROTECTED]>
wrote:
> This can be easily circumvented by distributing compressed/cacheable css/js
> in one minified/aggregated file. Combine that with good markup and an
> onDomReady event and the user experience will not suffer.
>
> - Dustin

I totally agree on that. @rDeeb: that YUI page explains pretty well
how and why to optimize your front-end application. As said by Dustin,
compressing JS and CSS is one of them. If I were you and I'd have 150K
of JS I'd seriously consider to rewrite some of it. The javascript
compiler blocks the browser from doing anything else while it is
compiling your 150K javascript file. So while your script is being
compiled the browser _could_ have been downloading your interface
images. If you move your scripts to the bottom of the page your
interface is loaded a little faster. If the javascript needs to be
executed completely before the user can interact with it you could
consider to place a small inline script in your head that adds a class
'loading' to your body tag, which is removed after the javascript is
executed. Change your stylesheet so it will hide the interface if the
class 'loading' is set on the body tag.

Hopefully this was of little help :-D. I was a bit skeptical myself
but my interface loads _way_ faster now that I merged my images in 2
css sprites and moved my scripts to the bottom of the page.

Kind Regards,

Marijn

>
> On 3/31/08 3:53 PM, "rDeeb" <[EMAIL PROTECTED]> wrote:
>
>
>
> > If you put the javascripts at the bottom  you may be breaking the site
> > usabillity, imagine you have a nice animation in your flash message,
> > just like the ones wordpress uses (I did one for the Admin Generator
> > Flash messages). And after the page renders, you start loading the JS
> > that are required for the animations, I use mootools, an aprox of 60k
> > with all features, but if you load prototype + script.acolo.us (or
> > whatever it spelled) could be ~ aprox 150 k or more, so your flash
> > message will animate (flash, fade or wipe in) after what 2,3,4 or 5
> > seconds after you saw the page? This breaks up the usabillity you
> > managed to build with JS, even if you use the onDomReady function you
> > will have to wait for all the library to load up. I rather prefer to
> > wait while the page loads the JS and start using it right away, than
> > see the page but can't fully use it cause it doesn't works cause no JS
> > had been loaded.
>
> > On Mar 25, 2:49 pm, "Alistair Stead" <[EMAIL PROTECTED]>
> > wrote:
> >> The simplest way to change were the JavaScript includes are added is to
> >> create your own version of sfCommonFilterthe content of which would be as
> >> follows this will allow you to continue to use the view.yml to control the
> >> css / javascript files but they will be placed in a more optimized 
> >> location.
>
> >> I did submit this as a proposed upgrade some months ago but it was never
> >> implimented...
>
> >> // execute next filter
>
> >>     $filterChain->execute();
>
> >>     // execute this filter only once
>
> >>     $response = $this->context->getResponse();
>
> >> sfLoader::loadHelpers(array('Tag', 'Asset'));
>
> >>     // include stylesheets
>
> >>     $content = $response->getContent();
>
> >>     if (false !== ($headPos = strpos($content, '</head>')))
>
> >>     {
>
> >>       $cssHtml = '';
>
> >>       if (!$response->getParameter('stylesheets_included', false,
> >> 'symfony/view/asset'))
>
> >>       {
>
> >>         $cssHtml = get_stylesheets($response);
>
> >>       }
>
> >>   // Place the CSS tags before the closing </head> tag
>
> >>       if ($cssHtml)
>
> >>       {
>
> >>         $response->setContent(substr($content, 0, 
> >> $headPos).$cssHtml.substr(
> >> $content, $headPos));
>
> >>       }
>
> >>     }
>
> >>   // include javascripts
>
> >>     $content = $response->getContent();
>
> >>     if (false !== ($bodyPos = strpos($content, '</body>')))
>
> >>     {
>
> >>       $jsHtml = '';
>
> >>       if (!$response->getParameter('javascripts_included', false,
> >> 'symfony/view/asset'))
>
> >>       {
>
> >>         $jsHtml = get_javascripts($response);
>
> >>       }
>
> >>       // Place the JS tags before the closing </body> tag
>
> >>       if ($jsHtml)
>
> >>       {
>
> >>         $response->setContent(substr($content, 0, $bodyPos).$jsHtml.substr(
> >> $content, $bodyPos));
>
> >>       }
>
> >>     }
>
> >>     $response->setParameter('javascripts_included', false,
> >> 'symfony/view/asset');
>
> >>     $response->setParameter('stylesheets_included', false,
> >> 'symfony/view/asset');
>
> >> Regards
>
> >> Alistair
>
> >> On 25/03/2008, Kris Wallsmith <[EMAIL PROTECTED]> wrote:
>
> >>> I just performed this optimization on one of my sites. It's as simple
> >>> as adding a call to the helper function include_javascripts() at the
> >>> bottom of your layout file(s). The common filter will know you've
> >>> already placed your Javascript includes and will only add stylesheets
> >>> to the <head> section.
>
> >>> Kris
>
> >>> On Mar 25, 9:23 am, Marijn <[EMAIL PROTECTED]> wrote:
> >>>> So I could just add some PHP code in a partial that would be included
> >>>> on the bottom of every template. The parial would first call
> >>>> get_javascripts and then delete all javascripts from the sfResponse
> >>>> object..?
>
> >>>> Thanks for your quick reply.
>
> >>>> Marijn
>
> >>>> On Mar 25, 4:56 pm, Robert Speer <[EMAIL PROTECTED]> wrote:> try
> >>> get_javascripts ()
>
> >>>>> the api is easiest to search here:http://www.gotapi.com/symfony
>
> >>>>> On Mar 25, 10:18 am, Marijn <[EMAIL PROTECTED]> wrote:
>
> >>>>>> Hi everybody,
>
> >>>>>> I think this is question belongs in the developer list, if not
> >>> please
> >>>>>> be kind enough to tell me ;-)
>
> >>>>>> Currently Symfony adds javascripts in the head tag of the page but I
> >>>>>> prefer to put them on the bottom of the page for faster rendering
> >>>>>> content on the page. For more information about that you can check
> >>> out
> >>>>>> this link from Yahoo on front-end
> >>> optimizationhttp://developer.yahoo.com/performance/rules.html#js_bottom(pret
> >>> ty
> >>>>>> useful I'd say).
>
> >>>>>> Is this something that can be considered as an option within symfony
> >>>>>> or do I need to hack my way through this. If so where to start..? A
> >>>>>> quick peek at the source didn't result in to much insight on the
> >>>>>> addJavascript function.
>
> >>>>>> Thanks,
>
> >>>>>> Marijn
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to