mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-15 03:53:32 +01:00
Not so great. Doesn't remove console.log(innerfunc()). Another approach would be to use a global debug() function and set debug to null in an included javascript file Signed-off-by: Jan Lindemann <jan@janware.com>
22 lines
805 B
Makefile
22 lines
805 B
Makefile
JAVA ?= /usr/bin/java
|
|
JS_MINIFY_EXE ?= $(JAVA) -jar /usr/share/java/closure-compiler.jar --compilation_level ADVANCED --strict_mode_input
|
|
JS_MINIFY_FILTER_IN ?= sed 's/console\.[a-z]\+([^)]\+) *;//g'
|
|
JS_LOCAL ?= $(wildcard *.js)
|
|
JS_SRC ?= $(filter-out %.min.js,$(JS_LOCAL))
|
|
JS_GENERATED ?= $(patsubst %.js,%.min.js,$(JS_SRC))
|
|
|
|
# This is not nice. It requires install-files to be included from elsewhere,
|
|
# which is not obvious. OTOH, if it isn't, SOURCE_FILES doesn't do any harm,
|
|
# either.
|
|
SOURCE_FILES += $(JS_GENERATED)
|
|
|
|
all: $(JS_GENERATED)
|
|
clean: minify.clean
|
|
|
|
%.min.js: %.js
|
|
cat $< | $(JS_MINIFY_FILTER_IN) > $@.filtered
|
|
$(JS_MINIFY_EXE) $@.filtered > $@.tmp
|
|
mv $@.tmp $@
|
|
|
|
minify.clean:
|
|
rm -f $(JS_GENERATED) *.tmp *.filtered
|