fix: tailwind failing on non-existant files (#2118)

This commit is contained in:
Marvin Hagemeister
2023-12-01 23:38:22 +01:00
committed by GitHub
parent 8fecb589ba
commit 2acf72d512
5 changed files with 38 additions and 3 deletions
+2
View File
@@ -3,6 +3,7 @@
// This file is automatically updated during development when running `dev.ts`.
import * as $_app from "./routes/_app.tsx";
import * as $_middleware from "./routes/_middleware.ts";
import * as $index from "./routes/index.tsx";
import { type Manifest } from "$fresh/server.ts";
@@ -10,6 +11,7 @@ import { type Manifest } from "$fresh/server.ts";
const manifest = {
routes: {
"./routes/_app.tsx": $_app,
"./routes/_middleware.ts": $_middleware,
"./routes/index.tsx": $index,
},
islands: {},
@@ -0,0 +1,15 @@
import { FreshContext } from "$fresh/server.ts";
export async function handler(
_req: Request,
ctx: FreshContext,
) {
if (ctx.url.pathname === "/middleware-only.css") {
return new Response(".foo-bar { color: red }", {
headers: {
"Content-Type": "text/css",
},
});
}
return await ctx.next();
}
+12
View File
@@ -37,3 +37,15 @@ Deno.test("TailwindCSS - config", async () => {
{ loadConfig: true },
);
});
Deno.test("TailwindCSS - middleware only css", async () => {
await withFakeServe(
"./tests/fixture_tailwind/dev.ts",
async (server) => {
const res = await server.get("/middleware-only.css");
const content = await res.text();
assertStringIncludes(content, ".foo-bar");
},
{ loadConfig: true },
);
});