-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathMakefile
58 lines (47 loc) · 2.28 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
DOMAIN="multiformats.io"
IPFSLOCAL="http://localhost:8080/ipfs/"
IPFSGATEWAY="https://ipfs.io/ipfs/"
OUTPUTDIR=public
NPMBIN=./node_modules/.bin
ifeq ($(DEBUG), true)
PREPEND=
APPEND=
else
PREPEND=@
APPEND=1>/dev/null
endif
build: install lint css
$(PREPEND)$(NPMBIN)/hugo && \
echo "" && \
echo "Site built out to ./$(OUTPUTDIR) dir"
help:
@echo 'Makefile for a multiformats.io, a hugo built static site. '
@echo ' '
@echo 'Usage: '
@echo ' make Build the optimised site to ./$(OUTPUTDIR) '
@echo ' make serve Preview the production ready site at http://localhost:1313 '
@echo ' make lint Check your CSS is ok '
@echo ' make css Compile the *.css to ./static/css '
@echo ' make dev Start a hot-reloding dev server on http://localhost:1313 '
@echo ' make clean remove the generated files '
@echo ' '
@echo ' DEBUG=true make [command] for increased verbosity '
clean:
$(PREPEND)[ ! -d $(OUTPUTDIR) ] || rm -rf $(OUTPUTDIR) && \
[ ! -d static/css ] || rm -rf static/css/*.css
node_modules:
$(PREPEND)npm i $(APPEND)
install: node_modules
$(PREPEND)[ -d static/css ] || mkdir -p static/css
lint: install
$(PREPEND)$(NPMBIN)/lessc --lint layouts/less/*
css: install
$(PREPEND)$(NPMBIN)/lessc --clean-css layouts/less/main.less static/css/main.css $(APPEND)
serve: install lint css
$(PREPEND)$(NPMBIN)/hugo server
dev: install css
$(PREPEND)( \
$(NPMBIN)/nodemon --watch layouts/css --exec "$(NPMBIN)/lessc --clean-css layouts/less/main.less static/css/main.css" & \
$(NPMBIN)/hugo server -w \
)
.PHONY: build help install lint css serve clean