Would it be possible to include this class (or letting people use download it and let the module use it if available) http://joliclic.free.fr/php/javascript-packer/en/

In my own code I've added include_once at the top of the module and below the line:

        $contents .= ";\n/* AGGREGATED JS FILE: $scripts_js_file */\n".$data."\n";

I added the following:

$packer = new JavaScriptPacker($contents, 'Normal', true, false);
$contents = $packer->pack();

UI wise it could be an option in the performance page which is greyed out if the packer class isn't downloaded, and when it is downloaded you could elect to use the class on the final file before saving (like I placed it after the current versions system).

CommentFileSizeAuthor
packer.php-1.0.zip16.88 KBpkej

Comments

pkej’s picture

Title: Minify (pack) javascript (to make yslow love the cached scripts) » Minify (removal of all comments and extra whitespace)
Status: Active » Postponed (maintainer needs more info)

Ah, never mind using this one. It creates lots of javascript errors b/c uncompressed scripts wont find the data they need. Of course, if a similar class without the packing, just with proper removal of whitespace, that would be a nice addition.

derjochenmeyer’s picture

the aggregator already removes large comments... i think that without packing the files, the space for improvement is in the range of less than 1% ...

moshe weitzman’s picture

core js aggregator for D6 had to roll back its packer because of incomptibilities with some scripts. i suggest sticking to just aggregation.

pkej’s picture

Status: Postponed (maintainer needs more info) » Closed (won't fix)

I've learned that the hardway.

Also, I saw that my score jumped to 80, some pages 90, on http://www.samipath.com anyway, so I'm happy with that.

chirale’s picture

There is a JSMin based solution:

http://drupal.org/node/251140