From d8bda573008ab1f23e30cb4f1533468090e5dddb Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 10 Jan 2023 09:04:11 +0100 Subject: Better asset handling; paragraph fix for new Pandoc versions; updated emojis --- Makefile | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index df13e15..1a7fae7 100644 --- a/Makefile +++ b/Makefile @@ -14,16 +14,19 @@ CONTENT_SRC := $(shell find content -type f -name "*.md") FEED_SRC := $(shell grep -l "^feed: *true$$" $(CONTENT_SRC)) CONTENT_TEMPLATES_SRC := $(shell find templates -type f -name "*.html") FEED_TEMPLATES_SRC := $(shell find templates -type f -name "*.xml") +FONT_SRC := $(wildcard assets/fonts/*.ttf) CSS_SRC := $(shell find assets/css -type f -name "*.scss") +ASSET_SRC := $(shell find content/assets -type f) +STATIC_SRC := $(shell find content -type f ! -name "*.md") CONTENT_META := $(patsubst content/%.md,.cache/meta/%.json,$(CONTENT_SRC)) CONTENT_FILES := $(patsubst content/%.md,out/%.html,$(CONTENT_SRC)) FEED_FILES := $(patsubst content/%.md,out/%.xml,$(FEED_SRC)) -FONT_FILES := $(patsubst assets/fonts/%.ttf,out/%.woff2,$(wildcard assets/fonts/*.ttf)) -CSS_FILES := $(patsubst assets/css/%.scss,out/%.css,$(wildcard assets/css/style.scss)) -STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -type f ! -name "*.md")) -TOP_STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -maxdepth 1 -type f ! -name "*.md")) -ASSET_FILES := $(FONT_FILES) $(CSS_FILES) out/icons.svg $(TOP_STATIC_FILES) +FONT_FILES := $(patsubst assets/fonts/%.ttf,out/assets/%.woff2,$(FONT_SRC)) +CSS_FILES := out/assets/style.css +ICON_FILES := out/assets/icons.svg +ASSET_FILES := $(FONT_FILES) $(CSS_FILES) $(ICON_FILES) $(patsubst content/assets/%,out/assets/%,$(ASSET_SRC)) +STATIC_FILES := $(patsubst content/%,out/%,$(STATIC_SRC)) # # TARGETS @@ -103,7 +106,7 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \ .cache/assets.json: $(ASSET_FILES) | .cache $(info [ASET] $@) - sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/(.*)/{ "\2": "\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@" + sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/assets\/(.*)/{ "\2": "\/assets\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@" out/%.html: content/%.md .cache/meta.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/page.lua | out $(info [MARK] $< -> $@) @@ -156,7 +159,7 @@ out/%/thumbnail.jpg: content/%/thumbnail.jpg | out mkdir -p $(@D) convert -thumbnail 550x280^ -gravity center -extent 550x280 "$<" ppm:- | cjpeg -quality 80 > "$@" -out/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out +out/assets/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out/assets $(info [FONT] $< -> $@) pyftsubset "$<" \ @@ -165,12 +168,12 @@ out/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out --flavor="woff2" \ --output-file="$@" -out/%.css: assets/css/%.scss $(CSS_SRC) | out +out/assets/%.css: assets/css/%.scss $(CSS_SRC) | out/assets $(info [SCSS] $< -> $@) sass --load-path=node_modules "$<" | ./node_modules/.bin/postcss --use autoprefixer --use postcss-csso --no-map -o "$@" -out/icons.svg: | out +out/assets/icons.svg: | out/assets $(info [ICON] $@) node ./node_modules/iro-icons/scripts/create_sprite.js \ @@ -200,15 +203,15 @@ out/%: content/% | out mkdir -p $(@D) cp "$<" "$@" -.cache/hash: | .cache - mkdir -p .cache/hash - .cache/meta: | .cache mkdir -p .cache/meta .cache: mkdir -p .cache +out/assets: | out + mkdir -p out/assets + out: mkdir -p out -- cgit v1.2.3-70-g09d2