This repository has been archived by the owner on Feb 5, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (64 loc) · 2.42 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
.PHONY: build templates lint docs publish docs-serve docs-build docs-publish
# Node binaries path
NODE_BIN=./node_modules/.bin
# Build input and output files
OUTPUT_CSS=./dist/siimple-colors.css
OUTPUT_MIN=./dist/siimple-colors.min.css
help:
@echo "Available commands: "
@echo ""
@echo " make build Generate the compiled CSS files of siimple-colors"
@echo " make install Install all dependencies"
@echo " make lint Run sass-lint"
@echo " make templates Compile all the templates"
@echo " make docs Generate documentation site"
@echo ""
build:
@logger -s "Build started"
${NODE_BIN}/sass ./index.scss ${OUTPUT_CSS}
@logger -s "Adding the header"
node ./scripts/header.js > ./dist/header.txt
cat ./dist/header.txt ${OUTPUT_CSS} > ${OUTPUT_CSS}.temp
rm ./dist/header.txt ${OUTPUT_CSS}
mv ${OUTPUT_CSS}.temp ${OUTPUT_CSS}
@logger -s "Autoprefix and clean generated css file"
${NODE_BIN}/postcss --use autoprefixer --config ./postcss.config.js --map false --output ${OUTPUT_CSS} ${OUTPUT_CSS}
${NODE_BIN}/cleancss --compatibility "*" --level 2 --output ${OUTPUT_MIN} ${OUTPUT_CSS}
@logger -s "Build finished"
lint:
${NODE_BIN}/sass-lint -v
templates:
@logger -s "Compile templates task started"
node ./scripts/templates.js --source scss
node ./scripts/templates.js --source test
@logger -s "Compile templates task finished"
install:
npm install
# Docs generation and serving
docs:
${MAKE} docs-build
${MAKE} docs-serve
# Build docs
docs-build:
@logger -s "Docs build task started"
@logger -s "Building documentation site"
mkdir -p ./docs/data && cp ./colors.json ./docs/data/
./node_modules/.bin/siimplepress --config docs/config.js
#cd ./docs && bundle exec jekyll build
@logger -s "Copying assets files"
#mkdir -p ./docs/_site/assets/css
#${NODE_BIN}/sass ./docs/_sass/main.scss ./docs/_site/assets/css/main.css --load-path=./bower_components/
#cp ./bower_components/siimple/dist/siimple.min.css ./docs/_site/assets/css/
cp ${OUTPUT_MIN} ./docs/public/css/
cp -R ./docs/images ./docs/public/
@logger -s "Docs build task finished"
# Serve docs
docs-serve:
${NODE_BIN}/stattic --folder ./docs/public/ --port 5000 --cors
# Publish docs
docs-publish:
@logger -s "Deploy started"
make docs-build
@logger -s "Deploying documentation website"
gsutil rsync -d -r ./docs/public gs://siimple-documentation.appspot.com/colors
@logger -s "Deploy finished"