diff options
author | Volpeon <git@volpeon.ink> | 2023-01-10 09:04:11 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2023-01-10 09:04:11 +0100 |
commit | d8bda573008ab1f23e30cb4f1533468090e5dddb (patch) | |
tree | 4d7e7f7c115e0bbe0c92787fd40d180d81f30fab /Makefile | |
parent | Update (diff) | |
download | volpeon.ink-d8bda573008ab1f23e30cb4f1533468090e5dddb.tar.gz volpeon.ink-d8bda573008ab1f23e30cb4f1533468090e5dddb.tar.bz2 volpeon.ink-d8bda573008ab1f23e30cb4f1533468090e5dddb.zip |
Better asset handling; paragraph fix for new Pandoc versions; updated emojis
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 27 |
1 files changed, 15 insertions, 12 deletions
@@ -14,16 +14,19 @@ CONTENT_SRC := $(shell find content -type f -name "*.md") | |||
14 | FEED_SRC := $(shell grep -l "^feed: *true$$" $(CONTENT_SRC)) | 14 | FEED_SRC := $(shell grep -l "^feed: *true$$" $(CONTENT_SRC)) |
15 | CONTENT_TEMPLATES_SRC := $(shell find templates -type f -name "*.html") | 15 | CONTENT_TEMPLATES_SRC := $(shell find templates -type f -name "*.html") |
16 | FEED_TEMPLATES_SRC := $(shell find templates -type f -name "*.xml") | 16 | FEED_TEMPLATES_SRC := $(shell find templates -type f -name "*.xml") |
17 | FONT_SRC := $(wildcard assets/fonts/*.ttf) | ||
17 | CSS_SRC := $(shell find assets/css -type f -name "*.scss") | 18 | CSS_SRC := $(shell find assets/css -type f -name "*.scss") |
19 | ASSET_SRC := $(shell find content/assets -type f) | ||
20 | STATIC_SRC := $(shell find content -type f ! -name "*.md") | ||
18 | 21 | ||
19 | CONTENT_META := $(patsubst content/%.md,.cache/meta/%.json,$(CONTENT_SRC)) | 22 | CONTENT_META := $(patsubst content/%.md,.cache/meta/%.json,$(CONTENT_SRC)) |
20 | CONTENT_FILES := $(patsubst content/%.md,out/%.html,$(CONTENT_SRC)) | 23 | CONTENT_FILES := $(patsubst content/%.md,out/%.html,$(CONTENT_SRC)) |
21 | FEED_FILES := $(patsubst content/%.md,out/%.xml,$(FEED_SRC)) | 24 | FEED_FILES := $(patsubst content/%.md,out/%.xml,$(FEED_SRC)) |
22 | FONT_FILES := $(patsubst assets/fonts/%.ttf,out/%.woff2,$(wildcard assets/fonts/*.ttf)) | 25 | FONT_FILES := $(patsubst assets/fonts/%.ttf,out/assets/%.woff2,$(FONT_SRC)) |
23 | CSS_FILES := $(patsubst assets/css/%.scss,out/%.css,$(wildcard assets/css/style.scss)) | 26 | CSS_FILES := out/assets/style.css |
24 | STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -type f ! -name "*.md")) | 27 | ICON_FILES := out/assets/icons.svg |
25 | TOP_STATIC_FILES := $(patsubst content/%,out/%,$(shell find content -maxdepth 1 -type f ! -name "*.md")) | 28 | ASSET_FILES := $(FONT_FILES) $(CSS_FILES) $(ICON_FILES) $(patsubst content/assets/%,out/assets/%,$(ASSET_SRC)) |
26 | ASSET_FILES := $(FONT_FILES) $(CSS_FILES) out/icons.svg $(TOP_STATIC_FILES) | 29 | STATIC_FILES := $(patsubst content/%,out/%,$(STATIC_SRC)) |
27 | 30 | ||
28 | # | 31 | # |
29 | # TARGETS | 32 | # TARGETS |
@@ -103,7 +106,7 @@ subpages = $(patsubst content/%.md,.cache/meta/%.json, \ | |||
103 | .cache/assets.json: $(ASSET_FILES) | .cache | 106 | .cache/assets.json: $(ASSET_FILES) | .cache |
104 | $(info [ASET] $@) | 107 | $(info [ASET] $@) |
105 | 108 | ||
106 | sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/(.*)/{ "\2": "\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@" | 109 | sha256sum $^ | sed -r 's/([0-9a-f]+) +out\/assets\/(.*)/{ "\2": "\/assets\/\2?\1" }/' | jq '{ assets: [inputs] | add | with_entries( .key |= gsub( "\\."; "_") ) }' > "$@" |
107 | 110 | ||
108 | out/%.html: content/%.md .cache/meta.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/page.lua | out | 111 | out/%.html: content/%.md .cache/meta.json .cache/assets.json $(CONTENT_TEMPLATES_SRC) metadata/*.yaml filters/*.lua scripts/page.lua | out |
109 | $(info [MARK] $< -> $@) | 112 | $(info [MARK] $< -> $@) |
@@ -156,7 +159,7 @@ out/%/thumbnail.jpg: content/%/thumbnail.jpg | out | |||
156 | mkdir -p $(@D) | 159 | mkdir -p $(@D) |
157 | convert -thumbnail 550x280^ -gravity center -extent 550x280 "$<" ppm:- | cjpeg -quality 80 > "$@" | 160 | convert -thumbnail 550x280^ -gravity center -extent 550x280 "$<" ppm:- | cjpeg -quality 80 > "$@" |
158 | 161 | ||
159 | out/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out | 162 | out/assets/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out/assets |
160 | $(info [FONT] $< -> $@) | 163 | $(info [FONT] $< -> $@) |
161 | 164 | ||
162 | pyftsubset "$<" \ | 165 | pyftsubset "$<" \ |
@@ -165,12 +168,12 @@ out/%.woff2: assets/fonts/%.ttf assets/fonts/glyphs.txt | out | |||
165 | --flavor="woff2" \ | 168 | --flavor="woff2" \ |
166 | --output-file="$@" | 169 | --output-file="$@" |
167 | 170 | ||
168 | out/%.css: assets/css/%.scss $(CSS_SRC) | out | 171 | out/assets/%.css: assets/css/%.scss $(CSS_SRC) | out/assets |
169 | $(info [SCSS] $< -> $@) | 172 | $(info [SCSS] $< -> $@) |
170 | 173 | ||
171 | sass --load-path=node_modules "$<" | ./node_modules/.bin/postcss --use autoprefixer --use postcss-csso --no-map -o "$@" | 174 | sass --load-path=node_modules "$<" | ./node_modules/.bin/postcss --use autoprefixer --use postcss-csso --no-map -o "$@" |
172 | 175 | ||
173 | out/icons.svg: | out | 176 | out/assets/icons.svg: | out/assets |
174 | $(info [ICON] $@) | 177 | $(info [ICON] $@) |
175 | 178 | ||
176 | node ./node_modules/iro-icons/scripts/create_sprite.js \ | 179 | node ./node_modules/iro-icons/scripts/create_sprite.js \ |
@@ -200,15 +203,15 @@ out/%: content/% | out | |||
200 | mkdir -p $(@D) | 203 | mkdir -p $(@D) |
201 | cp "$<" "$@" | 204 | cp "$<" "$@" |
202 | 205 | ||
203 | .cache/hash: | .cache | ||
204 | mkdir -p .cache/hash | ||
205 | |||
206 | .cache/meta: | .cache | 206 | .cache/meta: | .cache |
207 | mkdir -p .cache/meta | 207 | mkdir -p .cache/meta |
208 | 208 | ||
209 | .cache: | 209 | .cache: |
210 | mkdir -p .cache | 210 | mkdir -p .cache |
211 | 211 | ||
212 | out/assets: | out | ||
213 | mkdir -p out/assets | ||
214 | |||
212 | out: | 215 | out: |
213 | mkdir -p out | 216 | mkdir -p out |
214 | 217 | ||