fix: tailwind now respects basepath (#2138)
This commit is contained in:
@@ -4,7 +4,14 @@ export async function handler(
|
||||
_req: Request,
|
||||
ctx: FreshContext<{ data: string }>,
|
||||
) {
|
||||
ctx.state.data = "it works";
|
||||
if (ctx.url.pathname === "/foo/bar/middleware-only.css") {
|
||||
return new Response(".foo-bar { color: red }", {
|
||||
headers: {
|
||||
"Content-Type": "text/css",
|
||||
},
|
||||
});
|
||||
}
|
||||
ctx.state.data = "middleware is working";
|
||||
const resp = await ctx.next();
|
||||
resp.headers.set("server", "fresh server");
|
||||
return resp;
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
export default function Home() {
|
||||
return <h1>it works</h1>;
|
||||
}
|
||||
import { defineRoute } from "$fresh/server.ts";
|
||||
|
||||
export default defineRoute<{ data: string }>((req, ctx) => {
|
||||
return (
|
||||
<>
|
||||
<h1 class="text-red-600 block">it works</h1>
|
||||
{ctx.state.data}
|
||||
</>
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user