Fix public URL

This commit is contained in:
pietervdvn 2022-02-06 18:22:01 +01:00
parent 1bc1ef2578
commit 4ebf288bd6

View file

@ -35,16 +35,9 @@ then
echo "Source maps are enabled"
fi
if [ $BRANCH = "master" ]
then
PUBLIC_URL="./"
else
PUBLIC_URL="./mc/$BRANCH"
fi
echo -e "\n\n Building non-theme pages"
echo -e " ==========================\n\n"
parcel build --public-url "$PUBLIC_URL" $SRC_MAPS "index.html" "404.html" "professional.html" "automaton.html" "import_helper.html" "import_viewer.html" "land.html" "customGenerator.html" "theme.html" vendor
parcel build --public-url "./" $SRC_MAPS "index.html" "404.html" "professional.html" "automaton.html" "import_helper.html" "import_viewer.html" "land.html" "customGenerator.html" "theme.html" vendor
if [ $? -ne 0 ]; then
echo "ERROR - stopping the build"
exit 1
@ -64,12 +57,3 @@ do
exit 1
fi
done
# At last: a workaround; parcel 1.x borks the link to social images; the public-URL (./) is setup incorrectly, so we fix those
cd dist
echo -e "Fixing social images..."
for file in $(ls *.html)
do
echo "Hi!"
# sed -i 's!<meta content="\([^"]\+\)" property="og:image">!<meta content="./\1" property="og:image">!' $file
# sed -i 's!<meta property="og:image" content="\([^"]\+\)">!<meta content="./\1" property="og:image">!' $file
done