File:  [mozdev] / basic / src / compact-js
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Wed Aug 26 02:17:36 2009 UTC (8 years, 1 month ago) by basic
Branches: MAIN
CVS tags: cookiebutton_0_9_3, cookiebutton_0_9_2, HEAD
firefox 3.5 only
recompressed png files
combined css files
combined javascript files
get rid of dynamic script loading
remove old unused rdf chrome registration files
strip xml/xul/js/css files to make them smaller

#!/usr/bin/perl

open(FILE, '<', $ARGV[0]) or die $!;

undef $/;
$file = <FILE>;
$file =~ s%//[^\n]*\n|/\*(?:[^*]|\*(?!/))*\*/|('(?:\.|[^\\'])*')|("(?:\.|[^\\"])*")%$+%sg; # strip out c-style/c++-style comments
$file =~ s/\s+/ /sg; # not string friendly, but we don't care
$file =~ s/ ?([(){}[\]=:,+;.-]) ?/$1/g;
$file =~ s/\s+/ /sg; # not string friendly, but we don't care
close(FILE);
open(FILE, '>', $ARGV[0]) or die $!;
print FILE $file;
close(FILE);

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>