Skip to content

Commit

Permalink
Copy assets to app
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisreimann committed Nov 7, 2023
1 parent e6254ff commit dafd720
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions tasks/copy-assets-to-targets.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,32 @@
#!/bin/bash -e

if [ -d "$BTCPAY_TARGET" ]; then
cp dist/styles/btcpayserver-bootstrap.css "$BTCPAY_TARGET/BTCPayServer/wwwroot/main/bootstrap/bootstrap.css"
cp dist/scripts/bootstrap/* "$BTCPAY_TARGET/BTCPayServer/wwwroot/vendor/bootstrap/"
cp dist/svg/icons.svg "$BTCPAY_TARGET/BTCPayServer/wwwroot/img/icon-sprite.svg"
cp dist/svg/supporters.svg "$BTCPAY_TARGET/BTCPayServer/wwwroot/img/supporter-sprite.svg"
if [ -d "$BTCPAY_SERVER_WWWROOT" ]; then
cp dist/styles/btcpayserver-bootstrap.css "$BTCPAY_SERVER_WWWROOT/main/bootstrap/bootstrap.css"
cp dist/scripts/bootstrap/* "$BTCPAY_SERVER_WWWROOT/vendor/bootstrap/"
cp dist/svg/icons.svg "$BTCPAY_SERVER_WWWROOT/img/icon-sprite.svg"
cp dist/svg/supporters.svg "$BTCPAY_SERVER_WWWROOT/img/supporter-sprite.svg"

# Update default.css
rootSelector=":root {[\s\S]*?}\n"
defaultCSS="$BTCPAY_TARGET/BTCPayServer/wwwroot/main/themes/default.css"
defaultCSS="$BTCPAY_SERVER_WWWROOT/main/themes/default.css"
defaultRoot=$(cat dist/styles/btcpayserver-variables.css | grep -oPz "$rootSelector")
perl -0777 -i -pe "s/$rootSelector//" $defaultCSS
echo -e "$defaultRoot\n$(cat $defaultCSS)" > $defaultCSS

# Update default-dark.css
rootDarkSelector=":root\[data-btcpay-theme='dark'\] {[\s\S]*?}\n"
defaultDarkCSS="$BTCPAY_TARGET/BTCPayServer/wwwroot/main/themes/default-dark.css"
defaultDarkCSS="$BTCPAY_SERVER_WWWROOT/main/themes/default-dark.css"
defaultDarkRoot=$(cat dist/styles/btcpayserver-variables.css | grep -oPz "$rootDarkSelector" | sed "s/\[data-btcpay-theme='dark'\]//g")
perl -0777 -i -pe "s/$rootSelector//" $defaultDarkCSS
echo -e "$defaultDarkRoot$(cat $defaultDarkCSS)" > $defaultDarkCSS

echo "Copied assets to $BTCPAY_TARGET"
echo "Copied assets to $BTCPAY_SERVER_WWWROOT"
fi

if [ -d "$BTCPAY_APP_WWWROOT" ]; then
cp dist/styles/btcpayserver-bootstrap.css "$BTCPAY_APP_WWWROOT/bootstrap/bootstrap.css"
cp dist/scripts/bootstrap/* "$BTCPAY_APP_WWWROOT/bootstrap/"
cp dist/svg/icons.svg "$BTCPAY_APP_WWWROOT/img/icon-sprite.svg"

echo "Copied assets to $BTCPAY_APP_WWWROOT"
fi

0 comments on commit dafd720

Please sign in to comment.