[!NOTE] Historisch patroon: Het gebruik van GNU Make als frontend asset-pipeline was gebruikelijk voordat Vite, Webpack en esbuild de standaard werden. Het blijft een lichtgewicht benadering voor eenvoudige projecten.
Basiscompilatiepatroon
bin := ./node_modules/.bin
all: build/app.js
build/%.js: src/%.coffee
@mkdir -p $(@D)
@$(bin)/coffee < $< > $@
CSS-pipeline met Stylus & Autoprefixer
bin := ./node_modules/.bin
stylus := $(bin)/stylus
autoprefixer := $(bin)/autoprefixer
styl_files := $(shell find web/ -name "*.styl")
all: public/app.css
public/app.css: css/app.styl $(styl_files)
@mkdir -p $(@D)
@$(stylus) $< | $(autoprefixer) -b "> 1%" > $@
Bestandsbewakingslus (File Watching Loop)
Een eenvoudige shell-loop om make-doelen opnieuw uit te voeren bij bestandswijzigingen:
watch:
@echo "... watching for file changes"
@while true; do make -s; sleep 1; done
JavaScript bundelen met Browserify
js_files := $(shell find web/ -name "*.js")
public/app.js: web/app.js $(js_files)
@mkdir -p $(@D)
@$(browserify) -t [ cssify -x .css ] $< > $@