-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
53 lines (40 loc) · 989 Bytes
/
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
# Commands
LINT_CMD = node_modules/.bin/eslint
CSS_CMD = node_modules/.bin/postcss
NODE_CMD = node
# Directories
SRC_DIR = src/
DIST_DIR = dist/
# Git
REPO_GIT = git@github.com:micro-api/micro-api.git
CNAME = micro-api.org
# Phonies
.PHONY: build clean deploy lint
all: lint build
build:
mkdir -p $(DIST_DIR) $(DIST_DIR)assets
cp -rf $(SRC_DIR)assets $(DIST_DIR)
cp -f $(SRC_DIR)context.jsonld $(DIST_DIR)
echo $(CNAME) > $(DIST_DIR)CNAME
$(CSS_CMD) \
-u postcss-import \
-u postcss-cssnext \
-u cssnano \
-o $(DIST_DIR)assets/index.css \
$(SRC_DIR)css/index.css
$(NODE_CMD) $(SRC_DIR)build
clean:
rm -rf $(DIST_DIR)
lint:
$(LINT_CMD) $(SRC_DIR)
# Deploying to GitHub pages.
deploy:
(cd dist; \
[ ! -d .git ] && \
git init && \
git remote add origin $(REPO_GIT) && \
git fetch origin gh-pages && \
git branch gh-pages; \
git add -A && \
git commit -m 'Update website from Makefile.' && \
git push --force origin HEAD:gh-pages)