2009/3/20 Jeztah <webmas...@thecarmarketplace.com>:
>
> After a little playing ove the last couple of days i came up with a
> nice easy way of shrinking many js files on the fly into 1 file ...
> this will speed up load time heavily on heavy javascript loaded
> sites ..... the code is php and is very simple .. it also uses
> http://www.crockford.com/javascript/jsmin.html to achieve its goal ...
>
> Now i must say in my tests sites with  3 or less large javascript
> includes this wil not speed up much - infact it wil be slower ...
>
> My tests are as follows ..
>
> Using
>
> Latest Prototype.js
> Latest Scriptaculous.js
> Latest Effects.js
>
> [phpcode]
> require($_SERVER['DOCUMENT_ROOT'].'/resources/includes/server/
> jsmin.php'); // jsmin
> $docroot=$_SERVER['DOCUMENT_ROOT'];
> // array values need changing to reflect your include path(s)
> $jsArray=array( "p"=>"$docroot/resources/includes/client/proto.js",
>                                                                
> "f"=>"$docroot/resources/includes/client/functions.js",
>                                                                
> "s"=>"$docroot/resources/includes/client/scriptaculous.js",
>                                                                
> "e"=>"$docroot/resources/includes/client/effects.js"
>
>                                                                );
> $required_js=explode(",",$_GET['load']);
> foreach($required_js as $reqkey=>$reqvalue) {
>                echo JSMin::minify(file_get_contents($jsArray[$reqvalue]));
> }
> [/phpcode]
> Usage:
> URI -> js_load_min.php?load=p,s,e,f
>
> will go through the array and find the relevant files, then echo them
> out into one big file (minified on the fly) - this gets round the "2
> requests per domain Async" loading issues some people have with
> multiple CDNS and lots of remote images/includes - it can easily be
> ported to get the files remotely and some caching of some sort would
> easily be added ...
>
> On my test i loaded 5 javascript files from the same server as the
> page on thier own and page load was 4 seconds ... after using the
> above code i got the load time down to averageing 1.5 seconds per
> refresh.
>
> Then testing with only 3 files (prototype,scriptac,effects) the normal
> load method was around 1.8 seconds on 1st load, then dropped to 0.8
> (AVG) per refresh .. while the method above was 1.5 seconds on every
> load and refresh
>
> Someone may find this usefull / interesting and perhaps likes the
> concept and may want to do something with it, i dont have time at the
> moment !!!
>
> Regards
> Alex
>
> >
>

http://rakaz.nl/item/make_your_pages_load_faster_by_combining_and_compressing_javascript_and_css_files

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
prototype-scriptaculous+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to