]> git.rocketbowman.com Git - jetsam.git/commitdiff
feat: make assets portable by copying into build
authorKyle Bowman <kyle+github@rocketbowman.com>
Sat, 14 Dec 2024 15:58:55 +0000 (10:58 -0500)
committerKyle Bowman <kyle+github@rocketbowman.com>
Sat, 14 Dec 2024 15:58:55 +0000 (10:58 -0500)
.gitignore
Makefile
defaults.yml
scripts/index.sh

index 95464d3e664d8ded371e8c5ad6e843701019959b..d402616bed0460814f592b104688c32f9a213d71 100644 (file)
@@ -1,2 +1,3 @@
+.buildlist
 build/
 src/
index 26fdbbc6e16aa0cc394c39aab44468c1e154910c..f9d5c5c5eb6dd025134aa43a1a1018fad87fea60 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,41 +1,46 @@
-SRC_DIR := src
+ASSETS_DIR := assets
 BUILD_DIR := build
+SRC_DIR := src
 BUILD_LIST := $(shell find -L . -path './$(SRC_DIR)/**/*.md' | sed 's:./$(SRC_DIR):$(BUILD_DIR):g' | sed 's:\.md:\.html:g')
 
-.PHONY: clean help index
+.PHONY: all clean help 
 
 help:
        @echo "Builds HTML files from MD files. Targets include:"
        @echo
+       @echo "all              Builds the .buildlist and an index. (Top-level)"
        @echo "clean            Removes build artifacts."
        @echo "help             Prints this help message."
-       @echo "index            Builds an index of all the files in the $(BUILD_DIR) directory. (Top-level)"
-       @echo "$(BUILD_DIR)             Builds all the files defined in .buildlist."
        @echo ".buildlist       Defines a list of all files to build. Paths may be relative."
        @echo "         to this Makefile's directory. Paths should be on their own lines. You"
        @echo "         may create this file manually or override the BUILD_LIST variable when"
        @echo "         you invoke the make command. The default BUILD_LIST is created from MD files"
        @echo "         found anywhere under the $(SRC_DIR) directory."
 
-index: $(BUILD_DIR)
-       scripts/index.sh > build/index.html
+all: build/index.html
 
-$(BUILD_DIR): .buildlist
+build/index.html: .buildlist 
        xargs -n 1 make --no-print-directory < .buildlist
+       scripts/index.sh > build/index.html
 
 .buildlist:
        @echo $(BUILD_LIST) | tr ' ' '\n' > .buildlist
 
-$(BUILD_DIR)/%.html: $(SRC_DIR)/%.md 
+$(BUILD_DIR)/$(ASSETS_DIR): $(SRC_DIR)/$(ASSETS_DIR)
+       mkdir -p $(BUILD_DIR)/$(ASSETS_DIR)
+       cp -rL $(SRC_DIR)/$(ASSETS_DIR)/* $(BUILD_DIR)/$(ASSETS_DIR)
+
+$(BUILD_DIR)/%.html: $(SRC_DIR)/%.md $(BUILD_DIR)/$(ASSETS_DIR)
        @mkdir -p $(dir $@)
        @pandoc \
                --to=html5 \
                --standalone \
+               --toc=true \
                --defaults=./defaults.yml \
                --output=$@ $< \
                --lua-filter=scripts/links-to-html.lua
        @echo "Building $@ from $<..."
 
 clean:
-       rm .buildlist
+       -rm .buildlist
        rm -rf $(BUILD_DIR)
\ No newline at end of file
index fc7a2d3049add8a4dfe9839ea8b16b40849b1e05..86d307612e6f1f27dcd73dbdfb3f9eaa5ca342f1 100644 (file)
@@ -1,6 +1,6 @@
 from: markdown+wikilinks_title_before_pipe
 css:
   # ${.} is robust on build, but probably not for deployment
-  - ${.}/assets/css/normalize.css
-  - ${.}/assets/css/space-sakura.css
+  - ../assets/css/normalize.css
+  - ../assets/css/space-sakura.css
 
index 46ac3ad041d74260c9c0d9e3b55d773bcedbcbe6..404fbc5e2dde9b1d3511f2e1ede0fc4e03068044 100755 (executable)
@@ -67,5 +67,5 @@ make_boilerplate(){
 ########
 # MAIN #
 ########
-FILES="$(find "$BUILD_DIR" -type 'f' -not -name "*index.html" | sort)"
+FILES="$(find "$BUILD_DIR" -type 'f' -and -name '*.html' -not -name "*index.html" | sort)"
 make_boilerplate "$(make_ul "$FILES")"