[!NOTE] Historisches Muster: Die Verwendung von GNU Make als Frontend-Asset-Pipeline war vor Vite, Webpack und esbuild weit verbreitet. Es bleibt ein leichtgewichtiger Ansatz für einfache Projekte.
Grundlegendes Kompilierungsmuster
bin := ./node_modules/.bin
all: build/app.js
build/%.js: src/%.coffee
@mkdir -p $(@D)
@$(bin)/coffee < $< > $@
CSS-Pipeline mit 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%" > $@
Datei-Überwachungsschleife (File Watching Loop)
Eine einfache Shell-Schleife zur erneuten Ausführung von Make-Targets bei Dateiänderungen:
watch:
@echo "... watching for file changes"
@while true; do make -s; sleep 1; done
JavaScript-Bündelung mit Browserify
js_files := $(shell find web/ -name "*.js")
public/app.js: web/app.js $(js_files)
@mkdir -p $(@D)
@$(browserify) -t [ cssify -x .css ] $< > $@