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).
| Comment | File | Size | Author |
|---|---|---|---|
| packer.php-1.0.zip | 16.88 KB | pkej |
Comments
Comment #1
pkej commentedAh, 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.
Comment #2
derjochenmeyer commentedthe aggregator already removes large comments... i think that without packing the files, the space for improvement is in the range of less than 1% ...
Comment #3
moshe weitzman commentedcore js aggregator for D6 had to roll back its packer because of incomptibilities with some scripts. i suggest sticking to just aggregation.
Comment #4
pkej commentedI'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.
Comment #5
chirale commentedThere is a JSMin based solution:
http://drupal.org/node/251140