From e31a5b29a911f56b3f001fd17665de55a3b15e8d Mon Sep 17 00:00:00 2001 From: miker Date: Wed, 27 Oct 2010 16:42:46 +0000 Subject: [PATCH] A tool for interning CSS @import declarations, stripping comments, and removing useless whitespace git-svn-id: svn://svn.open-ils.org/ILS/trunk@18493 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- build/tools/intern_css_imports.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 build/tools/intern_css_imports.pl diff --git a/build/tools/intern_css_imports.pl b/build/tools/intern_css_imports.pl new file mode 100755 index 0000000000..6fa067cc64 --- /dev/null +++ b/build/tools/intern_css_imports.pl @@ -0,0 +1,16 @@ +#!/usr/bin/perl +my $in_comment = 0; +while (<>) { + chomp; + if (/^\s*\@import\s+url\((['"])([^'"]+)\1\)/) { + print `$0 $2` + } else { + s#(/\*).*?(\*/|$)##g; + $in_comment = 1 if ($1 && !$2); + s#(/\*|^).*?(\*/)##g; + $in_comment = 0 if ($2); + s/\s+$//; + s/^\s+//; + print "$_\n" unless ($in_comment || /^\s*$/) + } +} -- 2.43.2