File:  [mozdev] / basic / src / compact-css
Revision 1.2: download - view: text, annotated - select for diffs - revision graph
Wed Sep 2 20:20:33 2009 UTC (8 years, 1 month ago) by basic
Branches: MAIN
CVS tags: cookiebutton_0_9_3, cookiebutton_0_9_2, HEAD
optimisations

#!/usr/bin/perl

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

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

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