2020-12-13 05:04:01 +00:00
|
|
|
CSS_DIR = themes/etch-custom/assets/css
|
|
|
|
|
|
|
|
USER = deploy@seirdy.one
|
|
|
|
WWW_ROOT = /var/www/seirdy.one
|
|
|
|
GEMINI_ROOT = /srv/gemini/seirdy.one
|
|
|
|
|
|
|
|
WWW_RSYNC_DEST = $(USER):$(WWW_ROOT)
|
|
|
|
GEMINI_RSYNC_DEST = $(USER):$(GEMINI_ROOT)
|
|
|
|
|
2020-12-15 06:12:06 +00:00
|
|
|
OUTPUT_DIR = public
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-13 05:16:40 +00:00
|
|
|
RSYNCFLAGS += -rlvz --zc=zstd
|
2020-12-13 05:04:01 +00:00
|
|
|
|
|
|
|
# .hintrc-local for linting local files
|
|
|
|
# same as regular .hintrc but with a different connector.
|
|
|
|
.hintrc-local: .hintrc
|
|
|
|
jq --tab '.connector .name = "local" | del(.connector .options)' <.hintrc >.hintrc-local
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -rf $(OUTPUT_DIR) .hintrc-local
|
|
|
|
|
|
|
|
lint-css:
|
2020-12-16 07:18:18 +00:00
|
|
|
stylelint $(CSS_DIR)/main.css $(CSS_DIR)/dark.css
|
2020-12-13 05:04:01 +00:00
|
|
|
csslint $(CSS_DIR)
|
|
|
|
|
2020-12-16 07:16:01 +00:00
|
|
|
lint: lint-css hugo .hintrc-local
|
2020-12-13 05:04:01 +00:00
|
|
|
hint --config .hintrc-local -f codeframe $(OUTPUT_DIR)
|
|
|
|
|
2020-12-16 07:16:01 +00:00
|
|
|
check-links: hugo
|
2020-12-15 06:12:06 +00:00
|
|
|
lychee --verbose $(find public -type f -name '*.html' -o -name '*.gmi' -o -name '*.txt')
|
|
|
|
|
2020-12-16 07:16:01 +00:00
|
|
|
test: lint check-links
|
2020-12-15 06:12:06 +00:00
|
|
|
|
2020-12-13 05:04:01 +00:00
|
|
|
hugo:
|
2020-12-16 07:16:01 +00:00
|
|
|
hugo --gc
|
2020-12-13 05:04:01 +00:00
|
|
|
|
|
|
|
build: hugo
|
2020-12-13 06:07:00 +00:00
|
|
|
# gzip_static + max zopfli compression
|
2020-12-13 05:04:01 +00:00
|
|
|
ifndef NO_GZIP_STATIC
|
2020-12-19 02:32:55 +00:00
|
|
|
find $(OUTPUT_DIR) -type f -name '*.html' -o -name '*.css' -o -name '*.xml' -o -name '*.txt' -o -name '*.webmanifest' \
|
2020-12-13 05:04:01 +00:00
|
|
|
| grep -v gemini \
|
2020-12-13 06:07:00 +00:00
|
|
|
| xargs zopfli --i50 --gzip
|
2020-12-13 05:04:01 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
deploy: build
|
2020-12-13 06:07:00 +00:00
|
|
|
rsync $(RSYNCFLAGS) --exclude 'gemini' --exclude '*.gmi' --exclude-from .rsyncignore $(OUTPUT_DIR)/ $(WWW_RSYNC_DEST) --delete
|
|
|
|
rsync $(RSYNCFLAGS) --exclude '*.html' --exclude '*.xml' --exclude-from .rsyncignore $(OUTPUT_DIR)/gemini/ $(OUTPUT_DIR)/about $(OUTPUT_DIR)/posts $(OUTPUT_DIR)/publickey.txt $(GEMINI_RSYNC_DEST)/ --delete
|
|
|
|
rsync $(RSYNCFLAGS) $(OUTPUT_DIR)/posts/gemini.xml $(GEMINI_RSYNC_DEST)/feed.xml
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-16 07:16:01 +00:00
|
|
|
all: clean test deploy
|
2020-12-13 05:04:01 +00:00
|
|
|
|
2020-12-16 07:16:01 +00:00
|
|
|
.PHONY: clean lint-css lint check-links test hugo build deploy all
|