Minify (removal of all comments and extra whitespace)
pkej - February 28, 2008 - 13:47
| Project: | Javascript Aggregator |
| Version: | 5.x-1.2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | won't fix |
Jump to:
Description
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).
| Attachment | Size |
|---|---|
| packer.php-1.0.zip | 16.88 KB |

#1
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.
#2
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% ...
#3
core js aggregator for D6 had to roll back its packer because of incomptibilities with some scripts. i suggest sticking to just aggregation.
#4
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.
#5
There is a JSMin based solution:
http://drupal.org/node/251140