change all ttf fonts to woff2 and replace in public

main
bel 2023-10-15 07:25:13 -06:00
parent 47c11b8fba
commit 6c9d11f035
2 changed files with 27 additions and 3 deletions

View File

@ -38,7 +38,7 @@ spec:
when: build.event == "push" && build.target == "main"
spec:
name: build
container:
container:
image: andreysenov/firebase-tools
user: root
envs:
@ -46,5 +46,5 @@ spec:
GITLAB_PAT: ${{ secrets.get("resume-gitlab-gitlab-breel-dev-token") }}
shell: sh
script: |
apt -y install git
bash ./deploy.firebase.sh
apt -y install git woff2
bash ./deploy.firebase.sh

View File

@ -4,6 +4,7 @@ set -o pipefail
set -e
set -u
if tty && ! which firebase; then
f="$(mktemp)"
wget https://firebase.tools -O - > "$f"
@ -24,6 +25,29 @@ cp ./open-resume.com.d/resume.html.2 $outdir/public/index.html
cp ./open-resume.com.d/resume.pdf $outdir/public/BreeLaPointeResume.pdf
cp -r ./open-resume.com.d/fonts $outdir/public/
(
if ! which woff2_compress; then
sudo apt -y install woff2
fi
set -ueo pipefail
for f in "$outdir"/public/fonts/*.ttf; do
echo ttf to woff2 for "$f"
if [ -f "$f" ]; then
woff2_compress "$f"
rm "$f"
fi
basename_f="${f##*/}"
find "$outdir/public" -type f | grep -v public.fonts | while read -r f2; do
sed -i "s#$basename_f#${basename_f%.ttf}.woff2#g" "$f2"
done
echo asserting no $basename_f
! grep -R "$basename_f" "$outdir/public"
echo asserting ${basename_f%.ttf}.woff2
grep -R "${basename_f%.ttf}.woff2" "$outdir/public"
done
du -sh "$outdir/public/fonts/"*
)
cp -r ./firebase.json ./.firebaserc ./.firebase $outdir/
sed -i "s#deploy/public#public#" $outdir/firebase.json
cd $outdir