28 lines
604 B
Bash
28 lines
604 B
Bash
#!/usr/bin/env bash
|
|
|
|
# Install updates
|
|
pip3 install --upgrade --user pip &&
|
|
pip3 install --upgrade --user pelican markdown htmlmin &&
|
|
|
|
# Clean and generate
|
|
(rm -rf output || true) &&
|
|
python3 -c "import pelican; pelican.main()" content &&
|
|
|
|
# Optimize
|
|
tools/cssfix.py output/theme/css/* &&
|
|
(
|
|
for i in `find output -wholename "*.html"`
|
|
do
|
|
htmlmin -c -s "$i" "$i" || exit 1
|
|
done
|
|
) &&
|
|
|
|
# Compress
|
|
(
|
|
for i in `find output -wholename "*.css" -or -wholename "*.js" -or -wholename "*.html"`
|
|
do
|
|
(gzip --best --keep "$i" && brotli --best --keep "$i") ||
|
|
(echo ERROR in file $i; exit 1) || exit 1
|
|
done
|
|
)
|