From f41031bd19fd54229e1efb846254b5afdbd4331f Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Mon, 25 Oct 2021 23:04:23 +0200 Subject: [PATCH] word: minify put.js library using uglifyjs Reduce download size from 3.4kB compressed to just 1.2kB. Dependency node-uglify chosen because of Debian availability. --- .gitignore | 1 + Makefile | 4 +++- word/memory.plp | 2 +- word/quiz.plp | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 811bb08..f035906 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ # derived contents /sitemap.xml /light.css +/word/*.min.js # site owner tag for google webmaster tools /google????????????????.html diff --git a/Makefile b/Makefile index 0742e97..2e2b80a 100644 --- a/Makefile +++ b/Makefile @@ -17,10 +17,12 @@ sitemap.xml: tools/mksitemap light.css: tools/stripcss base.css $(call cmdsave,$^) -word: word/put.js data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json +word: word/put.min.js data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json word/put.js: $(download) tools/wget-ifmodified https://github.com/kriszyp/put-selector/raw/master/put.js $@ +word/%.min.js: word/%.js + uglifyjs -m '' $< -o $@ data/DerivedAge.txt: $(download) tools/wget-ifmodified http://www.unicode.org/Public/UNIDATA/$(@F) $@ diff --git a/word/memory.plp b/word/memory.plp index d12cc75..8847713 100644 --- a/word/memory.plp +++ b/word/memory.plp @@ -2,7 +2,7 @@ Html({ raw => <<'EOT', - +