Skip to content

Commit f4a667b

Browse files
feat: tailwind 4 in svelte
1 parent 8fb330d commit f4a667b

File tree

10 files changed

+13
-19
lines changed

10 files changed

+13
-19
lines changed

templates/sveltekit-example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
"@sveltejs/adapter-static": "^3.0.6",
2020
"@sveltejs/kit": "^2.9.0",
2121
"@sveltejs/vite-plugin-svelte": "^5.0.1",
22+
"@tailwindcss/postcss": "^4.0.0",
2223
"@types/eslint": "^9.6.1",
23-
"autoprefixer": "^10.4.20",
2424
"eslint": "^9.16.0",
2525
"eslint-config-prettier": "^9.1.0",
2626
"eslint-plugin-svelte": "^2.46.1",
@@ -30,7 +30,7 @@
3030
"prettier-plugin-svelte": "^3.3.2",
3131
"svelte": "^5.7.1",
3232
"svelte-check": "^4.1.1",
33-
"tailwindcss": "^3.4.16",
33+
"tailwindcss": "^4.0.0",
3434
"tslib": "^2.8.1",
3535
"typescript": "^5.7.2",
3636
"typescript-eslint": "^8.17.0",
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
export default {
22
plugins: {
3-
tailwindcss: {},
4-
autoprefixer: {}
3+
'@tailwindcss/postcss': {}
54
}
65
};

templates/sveltekit-example/src/app.css

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
@tailwind base;
2-
@tailwind components;
3-
@tailwind utilities;
1+
@import 'tailwindcss';
2+
@config '../tailwind.config.js';
43

54
@font-face {
65
font-family: 'JetBrains Mono';

templates/sveltekit-example/src/lib/components/Backdrop.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77
</script>
88

99
<div
10-
class:backdrop-blur-sm={spinner}
11-
class:backdrop-blur-xl={!spinner}
12-
class="fixed inset-0 z-40 bg-white/30 flex items-center justify-center"
10+
class="fixed inset-0 z-40 bg-white/30 dark:bg-lavender-blue-200/40 flex items-center justify-center backdrop-blur-xl"
1311
>
1412
{#if spinner}
1513
<div

templates/sveltekit-example/src/lib/components/Button.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<button
1414
{onclick}
1515
{disabled}
16-
class={`flex items-center gap-2 border-black dark:border-lavender-blue-500 border-[3px] transition-all rounded-sm py-1 px-8 my-2 font-semibold text-white bg-lavender-blue-500 dark:bg-black shadow-[5px_5px_0px_rgba(0,0,0,1)] dark:shadow-[5px_5px_0px_#7888ff] ${disabled === true ? 'opacity-25' : 'hover:bg-lavender-blue-600 dark:hover:bg-lavender-blue-300 dark:hover:text-black active:bg-lavender-blue-400 dark:active:bg-lavender-blue-500 active:shadow-none active:translate-x-[5px] active:translate-y-[5px]'}`}
16+
class={`flex items-center gap-2 border-black dark:border-lavender-blue-500 border-[3px] transition-all rounded-xs py-1 px-8 my-2 font-semibold text-white bg-lavender-blue-500 dark:bg-black shadow-[5px_5px_0px_rgba(0,0,0,1)] dark:shadow-[5px_5px_0px_#7888ff] ${disabled === true ? 'opacity-25' : 'hover:bg-lavender-blue-600 dark:hover:bg-lavender-blue-300 dark:hover:text-black active:bg-lavender-blue-400 dark:active:bg-lavender-blue-500 active:shadow-none active:translate-x-[5px] active:translate-y-[5px]'}`}
1717
>
1818
{@render children()}
1919
</button>

templates/sveltekit-example/src/lib/components/Footer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<footer
2-
class="mx-auto max-w-screen-2xl py-16 px-8 md:px-24 h-24 flex items-center justify-between md:justify-start md:gap-24 dark:text-white"
2+
class="mx-auto max-w-(--breakpoint-2xl) py-16 px-8 md:px-24 h-24 flex items-center justify-between md:justify-start md:gap-24 dark:text-white"
33
>
44
<span class="flex gap-2 items-baseline">
55
<svg

templates/sveltekit-example/src/lib/components/Modal.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
<div class="fixed inset-0 z-50 p-16 md:px-24 md:py-44 animate-fade" role="dialog">
9797
<div class="relative w-full max-w-xl">
9898
<textarea
99-
class="form-control block w-full px-3 py-1.5 text-base font-normal m-0 resize-none border-black border-[3px] rounded-sm bg-white shadow-[5px_5px_0px_rgba(0,0,0,1)] focus:outline-none"
99+
class="form-control block w-full px-3 py-1.5 text-base font-normal m-0 resize-none border-black border-[3px] rounded-xs bg-white shadow-[5px_5px_0px_rgba(0,0,0,1)] focus:outline-hidden"
100100
rows={7}
101101
placeholder="Your diary entry"
102102
bind:value={inputText}

templates/sveltekit-example/src/lib/components/Table.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<div class="py-2" role="rowgroup">
3838
{#each items as item, index}
3939
<div
40-
class="flex items-center gap-2 px-3 mb-4 border-black dark:border-lavender-blue-500 border-[3px] rounded bg-white dark:bg-black dark:text-white transition-all shadow-[8px_8px_0px_rgba(0,0,0,1)] dark:shadow-[8px_8px_0px_#7888FF]"
40+
class="flex items-center gap-2 px-3 mb-4 border-black dark:border-lavender-blue-500 border-[3px] rounded-sm bg-white dark:bg-black dark:text-white transition-all shadow-[8px_8px_0px_rgba(0,0,0,1)] dark:shadow-[8px_8px_0px_#7888FF]"
4141
role="row"
4242
>
4343
<span role="cell" aria-rowindex={index} class="p-1 flex align-center min-w-max">

templates/sveltekit-example/src/routes/+layout.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@
2626
</script>
2727

2828
<div class="relative isolate min-h-[100dvh]">
29-
<main class="mx-auto max-w-screen-2xl py-16 px-8 md:px-24 [@media(min-height:800px)]:min-h-[calc(100dvh-128px)]">
29+
<main
30+
class="mx-auto max-w-(--breakpoint-2xl) py-16 px-8 md:px-24 [@media(min-height:800px)]:min-h-[calc(100dvh-128px)]"
31+
>
3032
<h1 class="dark:text-white text-5xl md:text-6xl font-bold tracking-tight md:pt-24">
3133
Example App
3234
</h1>

templates/sveltekit-example/tailwind.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,9 @@ export default {
88
sans: ['JetBrains Mono', 'sans-serif', ...fontFamily.sans]
99
},
1010
extend: {
11-
screens: {
12-
tall: { raw: '(min-height: 800px)' }
13-
},
1411
animation: {
1512
fade: 'fadeIn .25s ease-in-out'
1613
},
17-
1814
keyframes: {
1915
fadeIn: {
2016
from: { opacity: '0' },

0 commit comments

Comments
 (0)