Skip to content

Instantly share code, notes, and snippets.

@jordwest
Created April 20, 2015 06:23
Show Gist options
  • Save jordwest/cd9d913195af945c3cb7 to your computer and use it in GitHub Desktop.
Save jordwest/cd9d913195af945c3cb7 to your computer and use it in GitHub Desktop.
Simple front-end builds with Makefiles
# Specify directories under /client/src to be copied directly
COPYDIRS = lib img
client: copy client/build/js/app.js client/build/css/app.css
clean:
rm -Rf client/build
rebuild: clean client
# SASS to CSS compilation
client/build/css/site.css: client/src/css/site.scss
mkdir -p client/build/css
sass client/src/css/site.scss > client/build/css/site.css
# JavaScript concatenation with TypeScript
tsfiles = $(shell find client/src/js -name '*.ts')
client/build/js/app.js: $(tsfiles)
mkdir -p client/build/js
tsc --sourceMap --out client/build/js/app.js client/src/js/app.ts
# Directly copy files
copy: $(COPYDIRS)
$(COPYDIRS):
mkdir -p client/build
rsync -rupE client/src/$@ client/build
.PHONY: client clean rebuild copy $(COPYDIRS)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment