Skip to content

Instantly share code, notes, and snippets.

@jcoglan
Last active August 29, 2015 13:56
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jcoglan/8829317 to your computer and use it in GitHub Desktop.
Save jcoglan/8829317 to your computer and use it in GitHub Desktop.
export PATH := node_modules/.bin:$(PATH)
source_files := $(wildcard lib/*.coffee)
build_files := $(source_files:%.coffee=build/%.js)
template_source := templates/*.handlebars
template_js := build/templates.js
app_bundle := build/app.js
spec_coffee := $(wildcard spec/*.coffee)
spec_js := $(spec_coffee:%.coffee=build/%.js)
libraries := vendor/jquery.js \
node_modules/handlebars/dist/handlebars.runtime.js \
node_modules/underscore/underscore.js \
node_modules/backbone/backbone.js
.PHONY: all clean test
all: $(app_bundle)
build/%.js: %.coffee
coffee -co $(dir $@) $<
$(template_js): $(template_source)
mkdir -p $(dir $@)
handlebars $(template_source) > $@
$(app_bundle): $(libraries) $(build_files) $(template_js)
uglifyjs -cmo $@ $^
test: $(app_bundle) $(spec_js)
phantomjs phantom.js
clean:
rm -rf build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment