Skip to content
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/react-server/examples/tailwind-v4/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tailwind v4
11 changes: 11 additions & 0 deletions packages/react-server/examples/tailwind-v4/app/_action.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"use server";

let count = 0;

export async function changeCount() {
count++;
}

export function getCount() {
return count;
}
9 changes: 9 additions & 0 deletions packages/react-server/examples/tailwind-v4/app/_client.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"use client";

import React from "react";

export function TestClient() {
const [count, setCount] = React.useState(0);

return <button onClick={() => setCount(count + 1)}>Client: {count}</button>;
}
13 changes: 13 additions & 0 deletions packages/react-server/examples/tailwind-v4/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type React from "react";
import "./styles.css";

export default function Layout(props: React.PropsWithChildren) {
return (
<html>
<body>
<div>[Layout]</div>
{props.children}
</body>
</html>
);
}
14 changes: 14 additions & 0 deletions packages/react-server/examples/tailwind-v4/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { changeCount, getCount } from "./_action";
import { TestClient } from "./_client";

export default function Page() {
return (
<>
<div>[Page]</div>
<TestClient />
<form action={changeCount}>
<button>Action: {getCount()}</button>
</form>
</>
);
}
1 change: 1 addition & 0 deletions packages/react-server/examples/tailwind-v4/app/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "tailwindcss";
25 changes: 25 additions & 0 deletions packages/react-server/examples/tailwind-v4/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@hiogawa/react-server-example-tailwind-v4",
"version": "0.0.0",
"private": true,
"type": "module",
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"@hiogawa/react-server": "workspace:*",
"next": "link:../../../react-server-next",
"react": "rc",
"react-dom": "rc",
"react-server-dom-webpack": "rc"
},
"devDependencies": {
"@tailwindcss/vite": "0.0.0-insiders.d684733",
"@types/react": "latest",
"@types/react-dom": "latest",
"tailwindcss": "0.0.0-insiders.d684733",
"vite": "latest"
}
}
17 changes: 17 additions & 0 deletions packages/react-server/examples/tailwind-v4/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"compilerOptions": {
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"skipLibCheck": true,
"verbatimModuleSyntax": true,
"noEmit": true,
"moduleResolution": "Bundler",
"module": "ESNext",
"target": "ESNext",
"lib": ["ESNext", "DOM"],
"types": ["next"],
"jsx": "react-jsx"
}
}
7 changes: 7 additions & 0 deletions packages/react-server/examples/tailwind-v4/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import tailwindcss from "@tailwindcss/vite";
import next from "next/vite";
import { defineConfig } from "vite";

export default defineConfig({
plugins: [next(), tailwindcss()],
});
4 changes: 3 additions & 1 deletion packages/react-server/src/features/assets/shared.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export const SERVER_CSS_PROXY = "virtual:server-css-proxy.js";
export const DEV_SSR_CSS = "virtual:dev-ssr-css.css";
// avoid .css prefix to exclude the virtual from tailwind v4's waitForRequestsIdle
// https://github.com/tailwindlabs/tailwindcss/blob/d684733d804a0b8951d13c94fe27350271e076b6/packages/%40tailwindcss-vite/src/index.ts#L313-L322
export const DEV_SSR_CSS = "virtual:dev-ssr-css";
Loading
Loading