-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·41 lines (34 loc) · 1.11 KB
/
build.sh
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
#!/bin/bash
function checkCommand() {
cmd=$1
if ! command -v $cmd &> /dev/null
then
echo "'$cmd' command could not be found!"
echo "run 'dart pub global activate $cmd'"
exit 1
fi
}
checkCommand webdev && checkCommand sass
resourceDir=$1
if [ -z "$1" ] || [ ! -d $resourceDir ]; then
echo "Invalid theme directory: '$1'"
exit -1
fi
if [ ! -d web/materialize ]; then
wget -P ~/Downloads https://mirror.ghproxy.com/https://github.com/materializecss/materialize/releases/download/1.2.0/materialize-src-v1.2.0.zip
unzip ~/Downloads/materialize-src-v1.2.0.zip
mv materialize-src/sass web/materialize
rm -rf materialize-src
fi
cd web && sass --style=compressed styles.scss styles.css && cd -
webdev build
assetDir=resource/_assets/website
if [ ! -d $assetDir ]; then
mkdir -p $assetDir
fi
cp build/main.dart.js $assetDir/dartbook.js
cp build/styles.css $assetDir/style.css
cp -r build/{materialize.js,icons.css,fonts} $assetDir
targetAssetDir="$resourceDir/_assets"
rm -rf $targetAssetDir/website && cp -r $assetDir $targetAssetDir
cp resource/_layouts/website/*.html $resourceDir/_layouts/website