Skip to content

Commit e7732cc

Browse files
authored
Extract global CSS (#10)
This pulls the global CSS from `+layout.svelte` into their own files. It also formats and deletes some leftover files :)
1 parent e1a7e59 commit e7732cc

8 files changed

Lines changed: 101 additions & 107 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
steps:
2727
- name: Checkout
2828
uses: actions/checkout@v4
29-
29+
3030
- name: Install pnpm
3131
uses: pnpm/action-setup@v4
3232
with:
@@ -37,12 +37,12 @@ jobs:
3737
with:
3838
node-version: 23
3939
cache: pnpm
40-
40+
4141
- name: Build site
4242
run: |
4343
pnpm install
4444
pnpm build
45-
45+
4646
- name: Upload site artifact
4747
uses: actions/upload-pages-artifact@v3
4848
with:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"prettier": "^3.5.3",
2828
"prettier-plugin-svelte": "^3.3.3",
2929
"remark-footnotes": "^2.0.0",
30-
"svelte": "^5.22.6",
30+
"svelte": "^5.23.0",
3131
"svelte-check": "^4.1.5",
3232
"typescript": "^5.8.2",
3333
"typescript-eslint": "^8.26.1",

pnpm-lock.yaml

Lines changed: 34 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/app.d.ts

Lines changed: 0 additions & 13 deletions
This file was deleted.

src/routes/+layout.svelte

Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -23,62 +23,9 @@
2323
</div>
2424

2525
<style>
26-
:global {
27-
/* Global site variables. */
28-
:root {
29-
--primary: #0c5;
30-
--primary-hover: #00a344;
31-
32-
--background-color: #383a39;
33-
34-
--text-color: #e7e7e7;
35-
--text-color-strong: #fff;
36-
--text-color-weak: #b1b1b1;
37-
38-
--font-family: "DM Serif Display", Georgia, serif;
39-
40-
--line-height: 1.5;
41-
42-
--border-radius: 30px;
43-
--border-color: black;
44-
45-
--transition-delay: 200ms;
46-
}
47-
48-
body {
49-
background-color: var(--background-color);
50-
color: var(--text-color);
51-
font-family: var(--font-family);
52-
line-height: var(--line-height);
53-
}
54-
55-
h1,
56-
h2,
57-
strong {
58-
color: var(--text-color-strong);
59-
}
60-
61-
a {
62-
color: var(--primary);
63-
transition: color var(--transition-delay);
64-
}
65-
66-
a:hover {
67-
color: var(--primary-hover);
68-
}
69-
70-
.token.comment {
71-
color: #a7a7a7;
72-
}
73-
74-
.token.constant {
75-
color: #80f880;
76-
}
77-
78-
.token.keyword {
79-
color: #0c5;
80-
}
81-
}
26+
@import "../styles/vars.css";
27+
@import "../styles/main.css";
28+
@import "../styles/syntax.css";
8229
8330
.container {
8431
max-width: 60em;

src/styles/main.css

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* Site-wide styles. */
2+
:global {
3+
body {
4+
background-color: var(--background-color);
5+
color: var(--text-color);
6+
font-family: var(--font-family);
7+
line-height: var(--line-height);
8+
}
9+
10+
h1,
11+
h2,
12+
strong {
13+
color: var(--text-color-strong);
14+
}
15+
16+
a {
17+
color: var(--primary);
18+
transition: color var(--transition-delay);
19+
}
20+
21+
a:hover {
22+
color: var(--primary-hover);
23+
}
24+
}

src/styles/syntax.css

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* Prism syntax highlighting theme. */
2+
:global {
3+
.token.comment {
4+
color: #a7a7a7;
5+
}
6+
7+
.token.constant {
8+
color: #80f880;
9+
}
10+
11+
.token.keyword {
12+
color: #0c5;
13+
}
14+
}

src/styles/vars.css

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/* Global site variables. */
2+
:global {
3+
:root {
4+
--primary: #0c5;
5+
--primary-hover: #00a344;
6+
7+
--background-color: #383a39;
8+
9+
--text-color: #e7e7e7;
10+
--text-color-strong: #fff;
11+
--text-color-weak: #b1b1b1;
12+
13+
--font-family: "DM Serif Display", Georgia, serif;
14+
15+
--line-height: 1.5;
16+
17+
--border-radius: 30px;
18+
--border-color: black;
19+
20+
--transition-delay: 200ms;
21+
}
22+
}

0 commit comments

Comments
 (0)