diff --git a/Makefile b/Makefile index b137b62..27fc053 100644 --- a/Makefile +++ b/Makefile @@ -1,48 +1,92 @@ # Makefile for Marp Slides Project -.PHONY: help build dev watch pdf html clean install deploy +.PHONY: help build dev watch pdf html clean install deploy assemble + +# Slide components +SLIDES_DIR = slides +BUILD_DIR = build +HEADER = $(SLIDES_DIR)/_frontmatter.md +INTRO = $(SLIDES_DIR)/_intro.md +OUTRO = $(SLIDES_DIR)/_outro.md + +# Termin files (date-topic naming convention) +TERMIN_1 = 2025-12-19-termin-1-grundlagen-text-audio +TERMIN_2 = 2026-01-09-termin-2-bild-audio-video +TERMIN_3 = 2026-01-23-termin-3-speichermedien-schnittstellen +TERMIN_4 = 2026-01-30-termin-4-distribution-apis-zukunft +TERMIN_5 = 2026-xx-xx-termin-5-vertiefung-offene-fragen +TERMINS = $(TERMIN_1) $(TERMIN_2) $(TERMIN_3) $(TERMIN_4) $(TERMIN_5) # Default target help: @echo "Available commands:" - @echo " make build - Build slides from Markdown" - @echo " make dev - Start development server with live reload" - @echo " make watch - Watch for changes and rebuild automatically" - @echo " make pdf - Export slides to PDF format" - @echo " make html - Export slides to HTML format" - @echo " make clean - Remove generated files" - @echo " make install - Install dependencies" - @echo " make deploy - Deploy slides to server" + @echo "" + @echo " Development:" + @echo " make dev - Start dev server (browse all files at localhost:1312)" + @echo "" + @echo " Build:" + @echo " make build - Build all slides (HTML + PDF)" + @echo " make pdf - Export all slides to PDF" + @echo " make html - Export all slides to HTML" + @echo "" + @echo " Other:" + @echo " make assemble - Assemble all termin files in build/" + @echo " make clean - Remove generated files" + @echo " make install - Install dependencies" + @echo " make deploy - Deploy slides to server" -# Build slides -build: - @echo "Building slides..." - npm run build +# Ensure build directory exists +$(BUILD_DIR)/.exists: + @mkdir -p $(BUILD_DIR) + @touch $@ -# Start development server -dev: - @echo "Starting development server..." - PORT=1312 npm run dev +# Assemble all termin files +assemble: $(BUILD_DIR)/.exists + @echo "Assembling slides..." + @for f in $(TERMINS); do \ + echo " $$f.md"; \ + cat $(HEADER) $(INTRO) $(SLIDES_DIR)/$$f.md $(OUTRO) > $(BUILD_DIR)/$$f.md; \ + done + @echo " all.md" + @cat $(HEADER) $(INTRO) $(foreach t,$(TERMINS),$(SLIDES_DIR)/$(t).md) $(OUTRO) > $(BUILD_DIR)/all.md + @cp -r assets $(BUILD_DIR)/ 2>/dev/null || true + +# Development server - serves build/ with file picker +dev: assemble + @echo "Starting dev server..." + @echo "Open: http://localhost:1312" + PORT=1312 npx @marp-team/marp-cli --server $(BUILD_DIR)/ # Watch for changes -watch: - @echo "Watching for changes..." - npm run watch +watch: assemble + npx @marp-team/marp-cli --watch $(BUILD_DIR)/all.md -# Export to PDF -pdf: +# Build all slides (HTML + PDF) +build: assemble + @echo "Building all slides..." + @for f in $(TERMINS); do \ + echo "Building $$f..."; \ + npx @marp-team/marp-cli $(BUILD_DIR)/$$f.md -o $(BUILD_DIR)/$$f.html; \ + npx @marp-team/marp-cli $(BUILD_DIR)/$$f.md --pdf --allow-local-files -o $(BUILD_DIR)/$$f.pdf; \ + done + @echo "Building all.md..." + npx @marp-team/marp-cli $(BUILD_DIR)/all.md -o $(BUILD_DIR)/all.html + npx @marp-team/marp-cli $(BUILD_DIR)/all.md --pdf --allow-local-files -o $(BUILD_DIR)/all.pdf + +# Export to PDF (all slides combined) +pdf: assemble @echo "Exporting to PDF..." - npm run export:pdf -- --allow-local-files + npx @marp-team/marp-cli $(BUILD_DIR)/all.md --pdf --allow-local-files -o $(BUILD_DIR)/all.pdf -# Export to HTML -html: +# Export to HTML (all slides combined) +html: assemble @echo "Exporting to HTML..." - npm run export:html + npx @marp-team/marp-cli $(BUILD_DIR)/all.md -o $(BUILD_DIR)/all.html # Clean generated files clean: @echo "Cleaning generated files..." - rm -rf dist/ build/ *.pdf *.html + rm -rf $(BUILD_DIR)/ *.pdf *.html # Install dependencies install: @@ -52,5 +96,5 @@ install: # Deploy slides deploy: build @echo "Deploying slides..." - scp build/index.html tengo@tuttle.uberspace.de:/home/tengo/html/malta/ - scp -r build/assets/ tengo@tuttle.uberspace.de:/home/tengo/html/malta/ + scp $(BUILD_DIR)/all.html tengo@tuttle.uberspace.de:/home/tengo/html/malta/index.html + scp -r $(BUILD_DIR)/assets/ tengo@tuttle.uberspace.de:/home/tengo/html/malta/ diff --git a/PLAN-split-slides.md b/PLAN-split-slides.md deleted file mode 100644 index 768556f..0000000 --- a/PLAN-split-slides.md +++ /dev/null @@ -1,65 +0,0 @@ -# Plan: Split index.md into multiple files - -## Current state -- ~4200 lines, 5 sessions + intro/outro -- Shared: frontmatter, styles, intro slides (title, about, schedule, survey, overview) -- Per-session: actual content - -## Proposed structure - -``` -slides/ -├── _frontmatter.yml # shared marp config -├── _styles.md # shared CSS -├── _intro.md # title, about, schedule, survey, overview -├── termin-1.md # Session 1 content -├── termin-2.md # Session 2 content -├── termin-3.md # Session 3 content -├── termin-4.md # Session 4 content -├── termin-5.md # TBA session -└── _outro.md # Q&A, license -``` - -## Makefile targets - -```makefile -# Shared parts -HEADER = slides/_frontmatter.yml slides/_styles.md -INTRO = slides/_intro.md -OUTRO = slides/_outro.md - -# Build single termin (intro + content + outro) -build-termin-%: - cat $(HEADER) $(INTRO) slides/termin-$*.md $(OUTRO) > build/termin-$*.md - marp build/termin-$*.md -o build/termin-$*.html - -# Dev mode for single termin -dev-%: - cat $(HEADER) $(INTRO) slides/termin-$*.md $(OUTRO) > build/.dev.md - PORT=1312 marp --server build/ - -# Build all -build-all: - cat $(HEADER) $(INTRO) slides/termin-*.md $(OUTRO) > build/all.md - marp build/all.md -o build/all.html -``` - -## Usage - -```bash -make dev-1 # preview termin 1 -make dev-3 # preview termin 3 -make build-termin-2 # build termin 2 -make build-all # build everything -``` - -## Trade-offs -- Requires intermediate file generation -- Can't use `marp --watch` directly on source (need wrapper) -- But: clean separation, single source of truth for styles - -## Status -- [ ] Learn Marp/Marpit in depth first -- [ ] Implement split -- [ ] Update Makefile -- [ ] Test all targets