...

View Full Version : Cutting down frameworks!!!!?????



Kelon
08-28-2009, 11:46 AM
Is there ever any merit in cutting down a lib to the essentials that a particular exercise needs....? Oh I dunno, example if you want one... cutting down MooTools to the essential elements needed by the mRotate script at http://www.piksite.com. Is there ever a scenario where it's worth doing... ever? Is it even feasible (or sensible)?

Yeah, this is one of those wildcard questions isn't it. It's a serious one :D, even if it's slightly mad.

Dimitar
08-28-2009, 02:52 PM
Is there ever any merit in cutting down a lib to the essentials that a particular exercise needs....? Oh I dunno, example if you want one... cutting down MooTools to the essential elements needed by the mRotate script at http://www.piksite.com. Is there ever a scenario where it's worth doing... ever? Is it even feasible (or sensible)?

Yeah, this is one of those wildcard questions isn't it. It's a serious one :D, even if it's slightly mad.

there's a new dependency checker which can look at what your script does and then list only relevant required components to be picked through the mootools.net downloader:

check http://www.aryweb.nl/projects/mooDeps/

now personally, i believe that using gzip on css and js files + some packer (not eval based, say, yahoo one) will really be a better option in saving bandwith. you remain with a framework with it's full capabilities at little or no cost to the end user. by doing so, you can even reference the google hosted versions of the frameworks and save yourself bandwith anyway.

but should the time come when a feature is needed you may have neglected to include, no "recompile" or re-download of mootools will be necessary (other frameworks' approaches disinterest me)

Kelon
08-28-2009, 03:44 PM
Oo, I see you've made the move to London then, Dimitar :thumbsup:. Late nights... yes, understood. I have a recipe for late nights called "Promise a site done for a certain time and then decide to push your own boundaries", cooks up late nights easy. Anyhow....

Again, another good link, thank you. I'm exploring all possibilities... as I've a site which, oh blah, blah, you know, image heavy, c/w movies, flash, whizzo, brand/product is showy-whizzo, so... how it is.... me being me, I'm still determined the site'll be as efficient as it can be.

Been reading gzip tech guide for IIS... an wondering how much fun I can stand all at once.

Thanks again for your opinion, useful, appreciated. Regards.

Dimitar
08-28-2009, 09:12 PM
oh IIS... that's not ideal. apache can use content type deflate filters which do the gzip on the fly but IIS... I am sure somebody figured it out. still, consider hosting on a CDN at least your js and css if you fail with the rest.

i think the best tool for optimising site speed by doing a series of updates/checks is the YSlow plugin for firebug by yahoo. i can't recommend it enough - it has really helped me optimise some heavy sites. it also has a meaningful performance measure as a yahoo speed index' - assigns a grade that's comparable to other sites etc.

there's also a firebug plugin by google called PageSpeed which can measure performance index as well as profile javascript, also rather nice... good luck optimising :)

oh and if you use mootools, there's also a bunch of things to help squeeze more juice out of the javascript itself but that's a separate subject altogether.

Kelon
08-28-2009, 09:49 PM
oh IIS... that's not ideal.., tell me about it. I'm pleased I've had a life free of IIS until a couple of projects ago. There is something in the documentation about deflate, but I've lost the will to live with the tech doc so have been doing the front-end stuff as I'm not into optimisation of the site proper yet.

YSlow is cool, good recommend., I'd not tripped over PageSpeed in my meanderings, thanks for the tip.

I've managed to get by repurposing the odd simple JavaScript having worked as part of a team to date, where serious JavaScript was someone else's bag. It's different now. Take it you'd recommend adopting MooTools? I like the talk of Objects and inheritance via prototypes... very ActionScript sounding.. and while MooTools claims "intermediate/advanced".. well I've enough experience of other languages to over-estimate my capabilities and dive-in - reckless, feckless idiot that I am.

All the best.

Dimitar
08-28-2009, 10:24 PM
mootools is the path to joy. classes, inheritance, etc. don't fall for the old intermediate to advanced crap either - especially if you know actionscript and vanilla js (hence ECMA) and OOP, you'll land right at home, reckless or otherwise :)

mootools is the marmite of frameworks really. you either love or hate the prototyping - i prefer to think of it as progressive enhancement of existing functions in the style of things that are coming to js anyway. those that oppose see it as making the playing field 'dirty' and thus interfering with other frameworks or scripts. oh well, can't make everyone happy, choosing a framework is not a simple matter anyway. i am just sitting tight and waiting for the quietly hyped up mootools 2.0 to take back the web :)

orca8767
09-01-2009, 01:37 AM
if you have any PHP support on a server ANYWHERE, here's a nice little script that will automatically gzip deflate js and css files if the browser supports it:

lib.php:

<?php
@ob_start('ob_gzhandler');

if(substr($_GET['src'], -3) == '.js')
$mime = 'text/javascript';
elseif(substr($_GET['src'], -4) == '.css')
$mime = 'text/css';

header('Content-type: '. $mime);
readfile($_GET['src']);
?>

What this does is it gets the file path from $_GET['src'] and reads the file after sending appropriate headers, and compresses it along the way, thanks to the second line.

Example usage:

<script type="text/javascript" src="lib.php?src=path/to/file.js"></script>

Which compresses and outputs the contents of the file at path/to/file.js



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum