192.168.0.2/Makefile

55 lines
1.3 KiB
Makefile

THEME = neff
LOCAL_DIR = /srv/http/staging
REMOTE_DIR = /srv/http/live
REMOTE = neff-steindesign.de@ssh.sterato.com:seiten/hugo
HUGO = /usr/bin/hugo
NPM = /usr/bin/npm
RSYNC = /usr/bin/rsync
JPEGOPTIM = /usr/bin/jpegoptim
OPTIPNG = /usr/bin/optipng
.PHONY: all clean server jpegoptim optipng site staging theme local upload
.SUFFIXES: .jpg .png .md .html .js .css .scss .toml
DIRS = content data static themes/$(THEME) resources
HUGO_ARGS = --gc --minify
IP := $(shell hostname --ip-address)
all: $(DIRS) public/*
clean:
rm -rf public/ resources/
theme:
$(NPM) --prefix="themes/$(THEME)" install --save-dev
$(NPM) --prefix="themes/$(THEME)" run build
site:
$(HUGO) $(HUGO_ARGS) --destination $(REMOTE_DIR)
local:
$(HUGO) $(HUGO_ARGS) --baseURL http://$(IP) --destination $(LOCAL_DIR)
staging:
$(HUGO) --buildDrafts --buildExpired --buildFuture --gc
upload:
$(RSYNC) -avz --delete $(REMOTE_DIR)/ $(REMOTE)
server: themes/$(THEME)/package-lock.json themes/$(THEME)/src
$(HUGO) server --buildDrafts --buildExpired --buildFuture --gc
$(DIRS): themes/$(THEME)/package-lock.json themes/$(THEME)/src
$(HUGO) --gc
themes/$(THEME)/package-lock.json:
$(NPM) --prefix="themes/$(THEME)" install --save-dev
themes/$(THEME)/src:
$(NPM) --prefix="themes/$(THEME)" run build
public/*:
$(RSYNC) -avz --delete public/ $(REMOTE)