Skip to content

Instantly share code, notes, and snippets.

@pawelgalazka
Created October 3, 2016 07:03
Show Gist options
  • Save pawelgalazka/fc9f4299cb641a6aee050ea51ad72144 to your computer and use it in GitHub Desktop.
Save pawelgalazka/fc9f4299cb641a6aee050ea51ad72144 to your computer and use it in GitHub Desktop.
Example of Makefile (for medium article)
PATH := node_modules/.bin:$(PATH)
SHELL := /bin/bash
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
@estelle11976
Copy link

estelleratte_api1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment