site.lyte.dev/makefile
2023-07-16 20:15:50 -05:00

43 lines
1.1 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/styles.css ; @${HUGO}
.PHONY: public
public: build
.PHONY: serve
serve:
@stylus -w src/stylus/styles.styl --sourcemap -o static/styles.css &
@${HUGO} serve
.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/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