Files
pythagoras/client/make.mk

34 lines
860 B
Makefile

CLIENT_PAGES := index.html
CLIENT_STYLES := style.css
CLIENT_SCRIPTS := script.js
CLIENT_TARGETS := $(CLIENT_PAGES:%=static/%) \
$(CLIENT_STYLES:%=static/%) \
$(CLIENT_SCRIPTS:%=static/%)
.PHONY: client_clean
client_clean:
rm -rf static
rm -rf client/node_modules
client/node_modules:
cd client && bun install
static/%.html: client/%.html client/node_modules
@mkdir -p $(@D)
cat $< | \
bun run --cwd client html-minifier \
--collapse-inline-tag-whitespace \
--collapse-boolean-attributes \
--collapse-whitespace \
--remove-attribute-quotes \
--remove-comments \
--remove-redundant-attributes > $@
static/%.css: client/%.scss client/node_modules
@mkdir -p $(@D)
bun run --cwd client sass $(notdir $<) --style compressed > $@
static/%.js: client/%.ts client/node_modules
@mkdir -p $(@D)
bun build $< --minify --outfile $@