Created
April 17, 2013 10:07
-
-
Save simenbrekken/5403187 to your computer and use it in GitHub Desktop.
Basic JS/CSS Makefile
This file contains hidden or 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
PATH := node_modules/.bin:bin:$(PATH) | |
HEAD = \ | |
vendor/raven-1.0.*.js \ | |
vendor/modernizr-2.6.*.js | |
VENDOR = \ | |
vendor/jquery-1.9.*.js \ | |
vendor/jquery.imagesloaded-2.1.*.js \ | |
vendor/lodash-1.0.*.js \ | |
vendor/spin-1.2.*.js \ | |
vendor/raf-0.0.*.js | |
SCRIPTS = $(shell find src/scripts -type f) | |
IMAGES = $(shell find src/images -type f) | |
app: public/head.js public/app.css public/app.js | |
dist: public/head.min.js public/app.min.css public/app.min.js | |
deploy: dist | |
af update | |
%.min.css: %.css | |
spriter --target images/generated/sprites/$(shell basename $< .css) --filter sprites/ $< | cleancss > $@ | |
optipng -o7 -quiet public/images/generated/sprites/*.png | |
advdef --quiet --recompress --shrink-insane public/images/generated/sprites/*.png | |
jpegoptim --quiet --strip-all public/images/*.jpg > /dev/null | |
public: | |
mkdir -p $@ | |
public/images: $(IMAGES) | public | |
rsync --recursive --perms --group --owner src/images/ $@ | |
touch $@ | |
public/head.js: $(HEAD) | public | |
cat $(HEAD) > $@ | |
public/head.min.js: public/head.js | |
uglifyjs $^ --mangle --compress --reserved Raven > $@ 2>/dev/null | |
public/app.css: public/images src/styles/*.styl | |
stylus --use nib --include src --include src/styles < src/styles/app.styl > $@ | |
public/app.js: $(VENDOR) $(SCRIPTS) | public | |
(cat $(VENDOR); browserify --transform browserify-ejs --require ./src/scripts/app) > $@ | |
public/app.min.js: $(VENDOR) $(SCRIPTS) | public | |
(cat $(VENDOR); browserify --transform browserify-ejs --require ./src/scripts/app) | uglifyjs --mangle --compress > $@ 2>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment