Skip to content

Instantly share code, notes, and snippets.

@jsscclr
Forked from jordwest/Makefile
Created October 28, 2016 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsscclr/bd5336da3703b61b219750e9c56a9d14 to your computer and use it in GitHub Desktop.
Save jsscclr/bd5336da3703b61b219750e9c56a9d14 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