site.lyte.dev/makefile

42 lines
1.0 KiB
Makefile

HUGO ?= hugo
DEV_SERVE ?= serve --buildDrafts --buildFuture --buildExpired
NETLIFY_DEPLOY ?= deploy -d public
LOCAL_IP ?= $(shell ip a | grep -oP '192\.168\.\d+\.\d+/' | head -n 1 | tr -d '/')
.PHONY: all
all: build
.PHONY: build
build: static/font.css static/styles.css ; @${HUGO}
.PHONY: public
public: build
.PHONY: dev
dev:
@stylus -w src/stylus/styles.styl --sourcemap -o static/styles.css &
@${HUGO} ${DEV_SERVE}
.PHONY: dev-ext
dev-ext:
@stylus -w src/stylus/styles.styl --sourcemap -o static/styles.css &
@${HUGO} ${DEV_SERVE} --bind ${LOCAL_IP} --baseURL ${LOCAL_IP}
.PHONY: clean
clean: ; @rm -r public
.PHONY: publish
publish: clean-css public ; @netlify ${NETLIFY_DEPLOY} && echo "Run \`make publish-prod\` when ready."
.PHONY: publish-prod
publish-prod: clean-css public ; @netlify ${NETLIFY_DEPLOY} --prod
static/font.css: src/stylus/font.styl
stylus --compress $< -o $@
static/styles.css: src/stylus/styles.styl $(shell find src/stylus -regex ".*\.styl")
stylus --compress $< -o $@
.PHONY: clean-css
clean-css: ; rm -f static/styles.css