mirror of
ssh://git.janware.com/srv/git/janware/proj/jw-pkg
synced 2026-01-18 04:53:57 +01:00
js.mk: Add JS_MINIFY_FILTER_IN
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>
This commit is contained in:
parent
4a42edbc1b
commit
f17ce9570c
4 changed files with 41 additions and 15 deletions
16
make/js.mk
16
make/js.mk
|
|
@ -1,8 +1,9 @@
|
|||
JAVA ?= /usr/bin/java
|
||||
JS_MINIFY_EXE ?= $(JAVA) -jar /usr/share/java/closure-compiler.jar
|
||||
JS_LOCAL ?= $(wildcard *.js)
|
||||
JS_SRC ?= $(filter-out %.min.js,$(JS_LOCAL))
|
||||
JS_GENERATED ?= $(patsubst %.js,%.min.js,$(JS_SRC))
|
||||
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,
|
||||
|
|
@ -13,8 +14,9 @@ all: $(JS_GENERATED)
|
|||
clean: minify.clean
|
||||
|
||||
%.min.js: %.js
|
||||
$(JS_MINIFY_EXE) $< > $@.tmp
|
||||
cat $< | $(JS_MINIFY_FILTER_IN) > $@.filtered
|
||||
$(JS_MINIFY_EXE) $@.filtered > $@.tmp
|
||||
mv $@.tmp $@
|
||||
|
||||
minify.clean:
|
||||
rm -f $(JS_GENERATED) *.tmp
|
||||
rm -f $(JS_GENERATED) *.tmp *.filtered
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue