Skip to content

Instantly share code, notes, and snippets.

@DamonOehlman
Last active December 25, 2015 15:39
Show Gist options
  • Save DamonOehlman/6999398 to your computer and use it in GitHub Desktop.
Save DamonOehlman/6999398 to your computer and use it in GitHub Desktop.
Simple and fairly generic makefile for building a UMDjs distribution for a browserifiable module
MODULE_NAME=glue
REQUIRED_TOOLS=browserify uglifyjs st inotifywait
PHONY: dist
$(REQUIRED_TOOLS):
@hash $@ 2>/dev/null || (echo "please install $@" && exit 1)
dist: $(REQUIRED_TOOLS)
@mkdir -p dist
@echo "building"
@browserify index.js > dist/$(MODULE_NAME).js --debug --standalone $(MODULE_NAME)
@echo "minifying"
@uglifyjs dist/$(MODULE_NAME).js > dist/$(MODULE_NAME).min.js 2>/dev/null
serve: dist
st --port 8000 --no-cache &
while true; do inotifywait -e create -e delete -e modify -q -r *.js node_modules || make dist; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment