A tool for interning CSS @import declarations, stripping comments, and removing usele...
authormiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 27 Oct 2010 16:42:46 +0000 (16:42 +0000)
committermiker <miker@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 27 Oct 2010 16:42:46 +0000 (16:42 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@18493 dcc99617-32d9-48b4-a31d-7c20da2025e4

build/tools/intern_css_imports.pl [new file with mode: 0755]

diff --git a/build/tools/intern_css_imports.pl b/build/tools/intern_css_imports.pl
new file mode 100755 (executable)
index 0000000..6fa067c
--- /dev/null
@@ -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*$/)
+    }
+}