Skip to content

Commit 48f8dbe

Browse files
committed
Migrate tailwindcss to v4, also use it from vite plugin
1 parent 74c7cdb commit 48f8dbe

File tree

11 files changed

+352
-635
lines changed

11 files changed

+352
-635
lines changed

astro.config.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@ import mdx from "@astrojs/mdx";
33
import { h } from "hastscript";
44
import sitemap from "@astrojs/sitemap";
55
import react from "@astrojs/react";
6-
import tailwind from "@astrojs/tailwind";
6+
import tailwindcss from "@tailwindcss/vite";
77
import remarkToc from "remark-toc";
88
import rehypeSlug from "rehype-slug";
99
import rehypeAutolinkHeadings from "rehype-autolink-headings";
1010
import metaTags from "astro-meta-tags";
1111

1212
// https://astro.build/config
1313
export default defineConfig({
14+
vite: {
15+
plugins: [tailwindcss()],
16+
},
1417
markdown: {
1518
remarkPlugins: [
1619
[
@@ -38,9 +41,6 @@ export default defineConfig({
3841
mdx(),
3942
sitemap(),
4043
react(),
41-
tailwind({
42-
nesting: true,
43-
}),
4444
metaTags(),
4545
],
4646
output: "static",

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
"@astrojs/mdx": "^4.1.0",
1717
"@astrojs/react": "^4.2.1",
1818
"@astrojs/sitemap": "^3.2.1",
19-
"@astrojs/tailwind": "^5.1.4",
2019
"@fontsource-variable/inter": "^5.1.1",
2120
"@tailwindcss/typography": "^0.5.16",
21+
"@tailwindcss/vite": "^4.0.12",
2222
"@types/react": "^19.0.10",
2323
"@types/react-dom": "^19.0.4",
2424
"astro": "^5.1.6",
@@ -33,7 +33,7 @@
3333
"rehype-slug": "^6.0.0",
3434
"remark-toc": "^9.0.0",
3535
"sharp": "^0.33.5",
36-
"tailwindcss": "^3.4.17",
36+
"tailwindcss": "^4.0.12",
3737
"typescript": "^5.7.3"
3838
},
3939
"devDependencies": {

pnpm-lock.yaml

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

src/components/button-link/button-link.astro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const resolvedIsExternal = isExternal !== undefined ? isExternal : url?.startsWi
1515
---
1616

1717
<a
18-
class={`font-bold text-lg px-4 py-4 bg-button rounded-[60px] inline-block leading-4 hover:bg-button-hover not-prose
18+
class={`font-bold text-lg px-4 py-4 bg-button rounded-[60px] leading-4 hover:bg-button-hover not-prose
19+
// workaround for https://github.com/tailwindlabs/tailwindcss/issues/15884
20+
// come on tailwind, was that really necessary?
21+
${className.includes("hidden") ? "hidden" : "inline-block"}
1922
${secondary || disabled ? "bg-primary text-white hover:bg-primary-hover" : "text-text-inverted"}
2023
${secondary ? "text-text" : ""}
2124
${className || ""}

src/components/header/header-actions.astro

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ export interface Props {
77
}
88
99
const { mobile = false }: Props = Astro.props;
10-
11-
const IS_LIVE = false;
1210
---
1311

1412
<div class="ml-auto flex items-center space-x-4">
@@ -24,12 +22,6 @@ const IS_LIVE = false;
2422
<ButtonLink url="https://voting.europython.eu" className="hidden md:block">
2523
<span>Community vote</span>
2624
</ButtonLink>
27-
{IS_LIVE && (
28-
<ButtonLink url="/live">
29-
Live
30-
<span class="hidden md:inline"> 📺</span>
31-
</ButtonLink>
32-
)}
3325
</>
3426
) : null
3527
}

src/components/header/header-button.astro

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
export interface Props {
33
href?: string;
4-
variant?: "standard" | "menu" | "live";
4+
variant?: "standard" | "menu";
55
}
66
77
const { href, variant = "standard" } = Astro.props;
@@ -10,12 +10,10 @@ const { href, variant = "standard" } = Astro.props;
1010
<a
1111
class:list={[
1212
"font-bold text-lg px-4 py-4 bg-secondary rounded-[60px] inline-block leading-4",
13-
"hover:bg-primary-hover hover:text-text-inverted",
13+
"hover:bg-primary-hover hover:text-text-inverted, text-text-inverted",
1414
{
1515
"bg-text": variant === "menu",
1616
"bg-primary": variant === "standard",
17-
"text-text-inverted": variant !== "live",
18-
"bg-red": variant === "live",
1917
},
2018
]}
2119
href={href}

src/components/header/header.astro

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,8 @@ const links = JSON.parse(await fs.readFile("./src/data/links.json", "utf-8"));
3939
name: "Code of Conduct",
4040
path: "https://www.europython-society.org/coc/",
4141
},
42-
/*
43-
{
44-
name: "Live 📺",
45-
path: "/live",
46-
},
47-
*/
4842
{
49-
name: "Recordings",
43+
name: "2024 Recordings",
5044
path: "https://www.youtube.com/playlist?list=PL8uoeex94UhE1CbtkDK4hevp2lBif57Nq",
5145
},
5246
...links.header,

src/pages/index.astro

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import Prague from "../components/hero-section/prague.astro";
1414
import * as intro from "../data/home/intro.md";
1515
import * as venue from "../data/home/prague.mdx";
1616
17+
import "../styles/global.css";
18+
1719
let deadlines = await getCollection("deadlines");
1820
deadlines = deadlines
1921
.sort((a, b) => a.slug.localeCompare(b.slug))

src/pages/schedule/[day].astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ posters.forEach((poster) => {
423423
</Layout>
424424

425425
<style>
426+
@reference "../../styles/global.css";
426427
:global(body) {
427428
overflow-x: hidden;
428429
}

src/styles/global.css

Lines changed: 40 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import "tailwindcss";
42

5-
:root {
3+
@theme {
64
--color-primary: #151f38;
75
--color-primary-hover: #7a7ebd;
86
--color-primary-active: #7a7ebd;
@@ -17,20 +15,44 @@
1715
--color-body-background: #f5e5d6;
1816
--color-hero-primary: #151f38;
1917
--color-hero-secondary: #fabc1b;
20-
18+
2119
--color-session-neutral: #f5e5d6;
2220
--color-session-beginner: #63d452;
2321
--color-session-intermediate: #ffcd45;
2422
--color-session-advanced: #d34847;
23+
24+
--color-sponsor-keystone: #5c9f92;
25+
--color-sponsor-diamond: #568497;
26+
--color-sponsor-platinum: #6b6c6e;
27+
--color-sponsor-gold: #f5c251;
28+
--color-sponsor-silver: #707172;
29+
--color-sponsor-bronze: #6e6151;
30+
--color-sponsor-patron: #a11217;
31+
}
32+
33+
@theme {
34+
--font-system: system-ui, sans-serif;
35+
--font-title: "Inter Variable", -apple-system, BlinkMacSystemFont, Segoe UI,
36+
Roboto, Helvetica, Arial, sans-serif, Apple Color Emoji,
37+
Segoe UI Emoji, Segoe UI Symbol;
38+
--font-sans: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto,
39+
Helvetica, Arial, sans-serif, Apple Color Emoji,
40+
Segoe UI Emoji, Segoe UI Symbol;
2541
}
2642

27-
.tp-dfwv {
28-
position: fixed !important;
29-
z-index: 9999;
43+
@theme {
44+
--aspect-ratio-hero: 2.4380530973;
3045
}
3146

47+
@theme {
48+
--tw-prose-headings: var(--color-text-inverted);
49+
}
50+
51+
@plugin "@tailwindcss/typography";
52+
3253
body {
33-
@apply bg-body-background text-text;
54+
background-color: var(--color-body-background);
55+
color: var(--color-text);
3456
}
3557

3658
.layout-wrapper {
@@ -50,6 +72,14 @@ body {
5072
grid-column: 1 / 4;
5173
}
5274

75+
.prose {
76+
color: var(--color-text);
77+
}
78+
79+
.prose :is(h1, h2, h3, h4, h5, h6) {
80+
color: var(--tw-prose-headings);
81+
}
82+
5383
.prose :is(h1, h2, h3, h4, h5, h6) a {
5484
text-decoration: none !important;
5585
}
@@ -105,7 +135,6 @@ ul.list-disc li::before {
105135
display: inline-block;
106136
width: 25px;
107137
height: 20px;
108-
/*background-image: url(/img/list-item.svg);*/
109138
background-size: 100%;
110139
background-repeat: no-repeat;
111140
background-position: 50% 50%;
@@ -117,6 +146,7 @@ ul.list-disc li::before {
117146
ul ul.list-disc li {
118147
list-style: disc;
119148
}
149+
120150
ul ul.list-disc li::before {
121151
display: none;
122152
}

0 commit comments

Comments
 (0)