[TYPO3-dev] Minifying Prototype and Scriptaculous
Jerome Schneider
typo3dev at ameos.com
Thu Jan 15 09:25:20 CET 2009
Hi Dmitry,
I agree with you. I also gzip the minified js in my projects, and it
works incredibly well
For instance, in ameos_formidable, where I rely on minify+gzip:
raw js: 174KB
minified js: 124KB
minified+gzipped: 32KB
To serve the gzip'd js as so, you have to serve it with a
"Content-Encoding: gzip" HTTP header
This can be done by apache using some apache rules, but for easy
deploiment what I alsways do is this:
My <script> tag refers to a php file containing these lines:
<?php
header("Content-Type: text/javascript");
header("Content-Encoding: gzip");
header("Cache-Control: max-age=86400, public");
fpassthru(fopen(realpath("./formidable.minified.js.gz"), "rb"));
exit;
?>
And this way the browser understand that he needs to dezip content
before using it.
One more thing: for best compression results, I use this command line:
gzip --best formidable.minified.js
--
See you in t3board !!!
Jerome
Dmitry Dulepov a écrit :
> Hi!
>
> I am playing with my test site to optimize its loading. I just found that if I minify Prototype, it becomes 25% smaller in size (93KB instead of 126) and for scriptaculous effects 38K become 29K (27% difference).
>
> I propose to ship minified versions of these scripts alongside with standard versions. The only drawback of this is that we must update minified versions when normal versions are updated. Otherwise it is only advantages to have minified versions.
>
> What do you think?
>
More information about the TYPO3-dev
mailing list