Created
November 5, 2011 17:34
-
-
Save bpierre/1341808 to your computer and use it in GitHub Desktop.
A Makefile to concatenate / minify my JS Scripts and convert/compress my Stylus (CSS preprocessor) files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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