Skip to content

Commit

Permalink
Overhaul CSS bundling.
Browse files Browse the repository at this point in the history
  • Loading branch information
lgarron committed Jan 5, 2025
1 parent 8db221f commit 13a550c
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 231 deletions.
Binary file modified bun.lockb
Binary file not shown.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"type": "module",
"types": "./dist/index.d.ts",
"dependencies": {
"@cubing/icons": "^2.1.0-pre.4",
"@fontsource/ubuntu": "^5.1.1",
"@types/dom-screen-wake-lock": "^1.0.1",
"@types/pouchdb": "^6.4.0",
"comlink": "^4.4.1",
Expand All @@ -25,7 +27,7 @@
"@biomejs/biome": "^1.9.0",
"@types/chai": "^4.3.6",
"@types/mocha": "^10.0.1",
"barely-a-dev-server": "^0.6.0",
"barely-a-dev-server": "^0.7.0",
"chai": "^4.3.8",
"esbuild": "^0.19.3",
"lib": "^5.1.0",
Expand Down
3 changes: 2 additions & 1 deletion script/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ barelyServe({
dev: false,
entryRoot: "src/timer.cubing.net",
outDir: "dist/timer.cubing.net",
bundleCSS: true,
esbuildOptions: {
external: ["crypto"],
loader: { ".svg": "copy", ".ico": "copy" },
Expand All @@ -27,7 +28,7 @@ await new Promise((resolve) => setTimeout(resolve, 1000));

await injectManifest({
globDirectory: "dist/timer.cubing.net/",
globPatterns: ["**/*.{js,ico,html,png,css,ttf,txt,svg}"],
globPatterns: ["**/*.{js,ico,html,png,css,ttf,woff,woff2,txt,svg}"],
swDest: "dist/timer.cubing.net/sw.js",
swSrc: "dist/timer.cubing.net/sw.js",
});
9 changes: 8 additions & 1 deletion script/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ barelyServe({
entryRoot: "src/timer.cubing.net",
devDomain: "timer.localhost",
port: 3334,
bundleCSS: true,
esbuildOptions: {
external: ["crypto"],
loader: { ".svg": "copy", ".ico": "copy" },
loader: {
".svg": "copy",
".ttf": "copy",
".woff": "copy",
".woff2": "copy",
".ico": "copy",
},
banner: {
js: "globalThis.global = globalThis; // Workaround for a `pouch-db` dep. 😕\n",
},
Expand Down

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.
Binary file not shown.
96 changes: 0 additions & 96 deletions src/timer.cubing.net/resources/vendor/fonts/ubuntu/UFL.txt

This file was deleted.

Binary file not shown.
13 changes: 11 additions & 2 deletions src/timer.cubing.net/ui/ScrambleView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,17 @@ export class ScrambleView {
setEvent(eventID: EventID) {
removeClassesStartingWith(this.scrambleText, "event-");
this.scrambleText.classList.add(`event-${eventID}`);
removeClassesStartingWith(this.cubingIcon, "icon-");
this.cubingIcon.classList.add(`icon-${eventID}`);

const iconEventID =
{
master_tetraminx: "mtetram", // TOOD
redi_cube: "redi", // TOOD
baby_fto: "pyramorphix", // similar image for now
}[eventID] ?? eventID;
removeClassesStartingWith(this.cubingIcon, "event-");
removeClassesStartingWith(this.cubingIcon, "unofficial-");
this.cubingIcon.classList.add(`event-${iconEventID}`);
this.cubingIcon.classList.add(`unofficial-${iconEventID}`);
if (
this.eventSelectDropdown.value !== eventID &&
this.optionElementsByEventID[eventID]
Expand Down
8 changes: 3 additions & 5 deletions src/timer.cubing.net/ui/style.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
@import "@cubing/icons/css";
@import "@fontsource/ubuntu";

@font-face {
font-family: digital-7-mono;
src: url("../resources/vendor/fonts/digital-7/digital-7-mono.ttf")
Expand All @@ -10,11 +13,6 @@
format("truetype");
}

@font-face {
font-family: "Ubuntu";
src: url("../resources/vendor/fonts/ubuntu/Ubuntu-Regular.ttf");
}

* {
box-sizing: border-box;
--main-text-size: min(max(min(5vh, 2.5rem), 1vw), 4vh);
Expand Down

0 comments on commit 13a550c

Please sign in to comment.