Fix 04b src when the site is in a subfolder

This commit is contained in:
mez 2025-08-29 19:57:44 +01:00
parent e179b011f2
commit ee0879ef79
5 changed files with 19 additions and 8 deletions

2
.gitignore vendored
View file

@ -4,6 +4,8 @@ build/index.html
build/decks/*/*.gif
build/decks/*/type
build/assets/banner.png
build/assets/fonts/*
!build/assets/fonts/04b24.ttf
build/assets/header.png
build/assets/levels/*.gif
build/assets/sketch/*.gif

7
build/font.css Normal file
View file

@ -0,0 +1,7 @@
@font-face {
src: url("/assets/fonts/04b24.ttf");
font-display: swap;
font-family: "04b24";
font-style: normal;
font-weight: 400;
}

View file

@ -1,11 +1,3 @@
@font-face {
src: url("/assets/fonts/04b24.ttf");
font-display: swap;
font-family: "04b24";
font-style: normal;
font-weight: 400;
}
/* basic colours */
:root {

View file

@ -667,6 +667,9 @@ if variables.keepsig == True:
def headerwrite(thefile,pagename):
header = open(thefile,"a")
header.write("<!DOCTYPE html>\n<html lang=\"en\" style=\"--headbg:" + variables.headerbackground + ";\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <link rel=\"stylesheet\" href=\"")
if len(variables.subfolder) > 0:
header.write("/" + variables.subfolder)
header.write("/font.css\">\n <link rel=\"stylesheet\" href=\"")
if len(variables.subfolder) > 0:
header.write("/" + variables.subfolder)
header.write("/style.css\">\n <link rel=\"stylesheet\" href=\"")

View file

@ -5,5 +5,12 @@ buildscript = open("build.sh","w")
buildscript.write("#!/usr/bin/env bash && python3 colors.py\n\nrclone copy build " + variables.servername + ":" + variables.serverpath + " -P -L")
buildscript.close()
fontloc = open("build/font.css","w")
fontloc.write("@font-face {\n src: url(\"")
if len(variables.subfolder) > 0:
header.write("/" + variables.subfolder)
fontloc.write("/assets/fonts/04b24.ttf\");\n font-display: swap;\n font-family: \"04b24\";\n font-style: normal;\n font-weight: 400;\n}\n")
fontloc.close()
if not os.path.exists("build/user.css"):
open("build/user.css","x")