-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
77 lines (60 loc) · 2.46 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
76
# Makefile
# This script download and process
# dependencies of this theme
# See the README for more details
CONTENT_PATH = "exampleSite/content"
deploy: CONTENT_PATH = "../../content"
deploy: given_resources dependencies
dependencies:
yarn install
-yarn searchjson --content=$(CONTENT_PATH)
mkdir -p static/js/codemirror/mode/
mkdir -p static/css/codemirror/theme/
cp node_modules/codemirror/lib/codemirror.js static/js/codemirror/
cp node_modules/codemirror/mode/python/python.js \
node_modules/codemirror/mode/xml/xml.js \
node_modules/codemirror/mode/javascript/javascript.js \
node_modules/codemirror/mode/css/css.js \
node_modules/codemirror/mode/htmlmixed/htmlmixed.js \
static/js/codemirror/mode/
cp node_modules/codemirror/theme/monokai.css static/css/codemirror/theme/
cp node_modules/codemirror/lib/codemirror.css static/css/codemirror/
cp node_modules/jquery/dist/jquery.min.js static/js/
cp node_modules/skulpt/dist/skulpt.min.js node_modules/skulpt/dist/skulpt-stdlib.js static/js/
cp node_modules/mathjax/es5/tex-svg.js static/js/
cp node_modules/lunr/lunr.min.js static/js/
clean_dependencies:
rm -rf node_modules
rm -rf static/js/codemirror
rm -rf static/css/codemirror
rm -rf static/js/jquery.min.js
rm -rf static/js/skulpt.min.js
rm -rf static/js/skulpt-stdlib.js
rm -rf static/js/tex-svg.js
rm -rf static/js/lunr.min.js
given_resources: SHELL := /bin/sh
given_resources:
# This script create zip files if
# there is multiple given resources
# See the README for more details
############################################
# This script is supposed to only be #
# runned by hugo sites that use this theme #
############################################
$(eval resources := $(shell find ${CONTENT_PATH} -type d -name given_resources))
$(foreach i,$(resources),\
$(eval nb_dirs := $(shell find $i/* -maxdepth 0 -type d | wc -l))\
$(eval nb_files := $(shell find $i -maxdepth 1 | wc -l))\
$(eval tp_name := $(shell basename "$(shell dirname "$(shell dirname "$i")")"))\
if [[ $(shell find $i -maxdepth 1 | wc -l) -gt 1 || $(nb_dirs) -gt 0 ]] ;\
then\
cd $i ;\
zip -r "$(tp_name).zip" . ;\
cd - ;\
fi ;\
)
clean_resources:
$(foreach i,$(shell find ${CONTENT_PATH} -type f -name "*.zip"),$(RM) $i)
preview: given_resources dependencies
hugo --config exampleSite/config.toml --contentDir exampleSite/content --themesDir ../ --theme prolotheme --ignoreCache server
clean: clean_resources clean_dependencies