Skip to content

Instantly share code, notes, and snippets.

@endel
Forked from bpierre/Makefile
Created January 28, 2014 14:17
Show Gist options
  • Save endel/8668485 to your computer and use it in GitHub Desktop.
Save endel/8668485 to your computer and use it in GitHub Desktop.
# JS files
JS_FINAL = js/project-name-all.js
JS_TARGETS = js/file1.js \
js/file2.js \
js/file3.js
# CSS files
CSS_FINAL = css/project-name-all.css
STYLUS_TARGETS = css/file1.styl \
css/file2.styl
# Binaries
UGLIFY_BIN = uglifyjs
STYLUS_BIN = stylus
STYLUS_PARAMETERS = -I /usr/local/lib/node_modules/nib/lib/
CSS_MINIFIED = $(STYLUS_TARGETS:.styl=.min.css)
JS_MINIFIED = $(JS_TARGETS:.js=.min.js)
all: $(JS_FINAL) $(CSS_FINAL)
# JS
$(JS_FINAL): $(JS_MINIFIED)
cat $^ >$@
rm -f $^
%.min.js: %.js
$(UGLIFY_BIN) -o $@ $<
echo >> $@
# CSS
$(CSS_FINAL): $(CSS_MINIFIED)
cat $^ >$@
rm -f $(CSS_MINIFIED)
%.min.css: %.styl
$(STYLUS_BIN) --compress $(STYLUS_PARAMETERS) <$< >$@
clean:
rm -f $(JS_FINAL) $(CSS_FINAL)
.DEFAULT_GOAL := all
.PHONY: clean css
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment