Also bundle css with bun so it busts caches

And updates the `build.rs` script so that it also builds a manifest.txt
for css files.
This commit is contained in:
2023-06-29 00:34:09 -04:00
parent ec90069c30
commit 74a205d51e
9 changed files with 53 additions and 22 deletions

79
frontend/css/styles.css Normal file
View File

@@ -0,0 +1,79 @@
/* Global */
html {
font-size: 18px;
line-height: 1.6em;
font-family: Helvetica, Arial, sans-serif;
}
/* Header */
header.header nav {
display: flex;
flex-direction: row;
align-items: baseline;
}
header.header nav h1 {
margin: 0;
}
header.header nav a {
text-decoration: none;
}
header.header nav ul {
display: flex;
flex-direction: row;
list-style: none;
margin: 0;
padding: 0;
}
header.header nav ul li {
margin-left: 16px;
}
/* Home */
ul.entries {
list-style: none;
margin: 24px 8px;
padding: 0;
}
ul.entries li {
margin-bottom: 8px;
}
ul.entries li em.domain {
margin-left: 8px;
color: rgba(0, 0, 0, 0.75);
}
/* Log */
pre#log {
font-size: 12px;
line-height: 1.2em;
}
/* Entry */
article {
max-width: 35em;
margin: 0 auto;
font-size: 18px;
}
article span.published {
font-size: 16px;
line-height: 1.2em;
}
article img {
max-width: 100%;
max-height: 100%;
width: auto;
height: auto;
}

View File

@@ -2,5 +2,8 @@ import { Application } from "@hotwired/stimulus";
import LocalTimeController from "./local_time_controller";
// import CSS so it gets named with a content hash that busts caches
import "../css/styles.css";
window.Stimulus = Application.start();
window.Stimulus.register("local-time", LocalTimeController);

View File

@@ -12,7 +12,11 @@ export default class extends Controller {
get localTimeString(): string {
if (this.utcTime) {
return this.utcTime.toLocaleDateString();
return this.utcTime.toLocaleDateString(window.navigator.language, {
year: "numeric",
month: "long",
day: "numeric",
});
}
return "Unknown datetime"
}

View File

@@ -3,7 +3,7 @@
"@hotwired/stimulus": "^3.2.1"
},
"name": "crawlnicle-frontend",
"module": "hello_controller.ts",
"module": "js/index.ts",
"type": "module",
"devDependencies": {
"bun-types": "^0.6.0"