Liquipedia
-
-
+
+
diff --git a/package.json b/package.json
index 46262a788dd..fc675dc336c 100644
--- a/package.json
+++ b/package.json
@@ -39,10 +39,11 @@
"lint:scss:ci": "stylelint \"stylesheets/**/*.scss\" --custom-formatter @csstools/stylelint-formatter-github",
"test:js": "jest",
"compile:scss": "sass stylesheets/Main.scss lua/output/css/main.css",
+ "fetch:remote-css": "bash scripts/fetch-remote-css.sh",
"build:css": "npm run compile:scss",
"build:js": "node build-js.js",
"build": "npm run build:css && npm run build:js",
"lua-test": "npm run build:css && busted -C lua",
- "update-snapshots": "UPDATE_SNAPSHOTS=true npm run lua-test"
+ "update-snapshots": "npm run fetch:remote-css && UPDATE_SNAPSHOTS=true npm run lua-test"
}
}
diff --git a/scripts/fetch-remote-css.sh b/scripts/fetch-remote-css.sh
new file mode 100644
index 00000000000..208289e9d7a
--- /dev/null
+++ b/scripts/fetch-remote-css.sh
@@ -0,0 +1,18 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+# The styles liquipedia.net serves for the lakesideview skin, fetched once per
+# run rather than once per snapshot.
+# TODO: We might in the future make the cacheversion dynamic
+URL='https://liquipedia.net/commons/load.php?cacheversion=cipipeline&lang=en&modules=fontawesome-pro|ext.TeamLiquidIntegration.liquipedia-custom-icon|skins.lakesideview.mw|skins.lakesideview.theme.commons&only=styles&skin=lakesideview'
+ORIGIN='https://liquipedia.net'
+OUTPUT='lua/output/css/lakeside.css'
+
+cd "$(dirname "$0")/.."
+mkdir -p "$(dirname "$OUTPUT")"
+
+# The sed puts back the origin on fonts, logos and icons, which the bundle
+# references from the site root, as both url(/x) and url("/x"). Off the local
+# filesystem those resolve nowhere.
+curl -fsS --compressed --max-time 30 "$URL" \
+ | sed -E 's|url\((["'\'']?)/|url(\1'"$ORIGIN"'/|g' > "$OUTPUT"