Skip to content

Instantly share code, notes, and snippets.

@moll
Created August 13, 2017 21:41
Show Gist options
  • Save moll/082bad97e953b584dae97f91291c3b56 to your computer and use it in GitHub Desktop.
Save moll/082bad97e953b584dae97f91291c3b56 to your computer and use it in GitHub Desktop.
Uglify Makefile
FILES = $(patsubst %, public/assets/%.js, html5)
UGLIFY = ./node_modules/.bin/uglifyjs
UGLIFY_OPTS = --stats --mangle
minify: $(patsubst %.js, %.min.js, $(FILES))
@for file in $^; do mv "$$file" "$${file%.min.js}.js"; done
public/assets/%.max.js: public/assets/%.js
@mv "$<" "$@"
public/assets/%.min.js: public/assets/%.max.js
@echo "Minifying $(@D)/$*.js…"
@$(UGLIFY) $(UGLIFY_OPTS) --output "$@" -- "$<"
.PHONY: minify
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment