tools: separate stripcss script to build css
authorMischa POSLAWSKY <perl@shiar.org>
Sun, 11 Jun 2017 00:45:35 +0000 (02:45 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Mon, 17 Jul 2017 15:13:42 +0000 (17:13 +0200)
Expanded for readability but otherwise identical code.

Makefile
tools/stripcss [new file with mode: 0755]

index 349e34f9399f2d8d2584c13c7caf4388653cdcfb..9746c9667f58fc373276d27e374c52d498226d90 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,8 @@ gitsave = @if cd $@ 2>/dev/null; \
 sitemap.xml: tools/mksitemap
        $(call cmdsave,$<)
 
-light.css: base.css
-       $(call cmdsave,perl -pe '\''s!\s*/\*.*\*/\Z!!; s/^\s*//; s/\h+/ /g; s/:\K\h+//;'\'',$<)
+light.css: tools/stripcss base.css
+       $(call cmdsave,$^)
 
 data/DerivedAge.txt:
        tools/wget-ifmodified http://www.unicode.org/Public/UNIDATA/$(@F) $@
diff --git a/tools/stripcss b/tools/stripcss
new file mode 100755 (executable)
index 0000000..4b41f01
--- /dev/null
@@ -0,0 +1,11 @@
+#!/usr/bin/env perl
+use 5.014;
+use warnings;
+
+while (<>) {
+       s!\s*/\*.*\*/\Z!!;  # comments
+       s/^\s*//;   # indentation and empty lines
+       s/\h+/ /g;  # alignment
+       s/:\K\h//;  # separators
+       print;
+}