[TYPO3-core] RFC: minify JavaScript

Ernesto Baschny [cron IT] ernst at cron-it.de
Tue Sep 11 16:31:46 CEST 2007


Dmitry Dulepov [typo3] wrote: on 11.09.2007 12:50:

> This is SVN patch request.
> 
> Branch: trunk
> 
> Problem: we can save lots of web traffic if we generate less spacey
> (spicy? ;)) JavaScript. For example, just a combination of blur and
> spam-protect scripts gives 400 bytes savings for each request. Yesterday
> I had approximately 600000 visits on one site yesterday, which gives 228
> megabytes of useless traffic! Of course it will be less dramatic with
> gzip enabled but still...
> 
> Solution: use JSMin library (Expat (MIT) license, compatible with GPL)
> to minify javascript. Catch errors and return unminified script if error
> happens. It is safe because JSMin was around for ages and used by many
> products nowadays. Result is cached, so no real impact on performance.
> 
> There are two patches: full (with JSMin in typo3/contrib/jsmin) and
> short (with only typo3 code). You can look at short only but you need to
> apply full patch. Add "config.minifyJS=1" to TS template and see the
> effect. This works also with

Cool stuff, it works. +1 for the addition.

Attached is a patch which will also externalize (and optionally minify)
the "openPic", "over" and "out" (mouseOver) and any other
"additionalJavaScript". I wonder if this is too risky, as there might be
dynamic javascript in there coming from extensions
(additionalJavaScript), which would pollute the typo3temp. I left out
JSImgCode on purpose, but we could add that too to this process.

Opinios?

Cheers,
Ernesto
-------------- next part --------------
A non-text attachment was scrubbed...
Name: jsmin_tslibfe.diff
Type: text/x-diff
Size: 1142 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070911/24dcb7ac/attachment-0001.diff 


More information about the TYPO3-team-core mailing list