~jeffa/old-jeffa.io

ref: b3b87a4bc53e647fb00b636c22baa7b1fbc90b92 old-jeffa.io/client/build.sh -rw-r--r-- 1.1 KiB
b3b87a4bJeff Anderson Update homepage; Remove recommended.md 1 year, 15 days ago
                                                                                
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
#! /bin/bash
#
# Run this script from the project root
#
# Step 1 - Output folders
# Create or empty build, client and client/tmp directories

if [ -e client/build/ ]
    then
    rm -r client/build/*
else
    mkdir client/build
fi

mkdir \
    client/build/tmp \
    client/build/woff2 \

# Step 2 - Markdown Conversion
# Compile Markdown to HTML

for file in client/src/content/*.md
do
    pandoc "$file" \
        -V nav="$(pandoc -t html5 client/src/content/sidebar/sidebar.md)" \
        --defaults client/pandoc/article.yml \
        -o "${file%.md}.html"
done

mv client/src/content/*.html client/build/ && \

# Step 3 - Assets
# Trim unused CSS and minify the output to a single file

purgecss \
    --css client/src/stylesheets/*.css \
    --content client/build/*.html \
    --output client/build/tmp && \

uglifycss client/build/tmp/*.css > client/build/index.css && \

# Copy assets to client/build

cp client/src/images/* client/build/ && \
    cp client/src/stylesheets/woff2/* client/build/woff2/ && \
    mv client/build/jeffa.ico client/build/favicon.ico &&

# Step 4
# Clean up by removing client/build/tmp/

rm -r client/build/tmp