-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathjustfile
More file actions
106 lines (91 loc) · 2.5 KB
/
Copy pathjustfile
File metadata and controls
106 lines (91 loc) · 2.5 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
set default-list
# Compile Tailwind css, then build the site with Zola
build: build-tailwind
zola build
# Generate Tailwind static/style.css from css/style.css
build-tailwind:
npm run tailwind:build
# Try to build site without rendering (checks links)
check:
zola check
# Run Tailwind watch and Zola live serve in parallel
dev:
npm run dev
# Clear public directory generated by Zola
reset:
rm -rf public
# Install Node.js dependencies
install: npm basecoat
@echo "Successfully installed dependencies and copied basecoat files to static."
[private]
npm:
npm install
[private]
basecoat:
mkdir -p static/js/
cp node_modules/basecoat-css/dist/js/*.js static/js/
# Create a new documentation page at content/{{path}}.qmd
page path:
#!/usr/bin/env bash
set -euo pipefail
if [ -f "content/{{ path }}.qmd" ]; then
@echo "Error: content/{{ path }}.qmd already exists."
exit 1
fi
cat > "content/{{ path }}.qmd" <<-EOF
---
title:
description: ""
weight: 0
extra:
short_title:
---
EOF
@echo "Created content/{{ path }}.qmd"
# Create a new blog post at content/blog/{{title}}/index.qmd
post title:
#!/usr/bin/env bash
set -euo pipefail
date=$(date +%Y-%m-%d)
dir="content/blog/${date}-{{ title }}"
mkdir -p "$dir"
cat > "$dir/index.qmd" <<-EOF
---
title: {{ title }}
date: "$date"
authors: []
taxonomies:
tags: []
---
EOF
@echo "Created $dir/index.qmd"
# Render a documentation page at content/{{path}}.qmd
render-page path: (render-one path)
# Render a blog post at content/blog/{{title}}/index.qmd
render-post title: (render-one ("blog" / title / "index"))
[private]
render-one path:
#!/usr/bin/env bash
set -euo pipefail
cd content
if [ -f "{{ path }}.qmd" ]; then
rm -f "{{ path }}.md"
quarto render "{{ path }}.qmd" {{ quarto_out + " " + quarto_flags }}
else
@echo "Error: Could not find content/{{ path }}.qmd."
exit 1
fi
# Render all pages in content/ recursively (ignores blog/)
render:
#!/usr/bin/env bash
set -euo pipefail
shopt -s globstar nullglob
cd content
for page in **/*.qmd; do
[[ "$page" == blog/* ]] && continue
rm -f "${page%.qmd}.md"
quarto render "$page" {{ quarto_out + " " + quarto_flags }}
done
@echo "Successfully rendered all documentation pages."
quarto_out := "--to commonmark+yaml_metadata_block"
quarto_flags := "-M engine:knitr -M wrap:preserve -M from:markdown-smart"