diff --git a/plugins/tailwind.ts b/plugins/tailwind.ts index d3c2e47f..0c432666 100644 --- a/plugins/tailwind.ts +++ b/plugins/tailwind.ts @@ -85,12 +85,12 @@ export default function tailwind(): Plugin { handler: async (req, ctx) => { const pathname = new URL(req.url).pathname; - if (req.url.endsWith(".css.map")) { + if (pathname.endsWith(".css.map")) { const cached = cache.get(pathname); if (cached) return Response.json(cached.map); } - if (!req.url.endsWith(".css") || !processor) { + if (!pathname.endsWith(".css") || !processor) { return ctx.next(); } diff --git a/tests/tailwind_test.ts b/tests/tailwind_test.ts index 2f8ffb31..f7740733 100644 --- a/tests/tailwind_test.ts +++ b/tests/tailwind_test.ts @@ -1,11 +1,15 @@ import { runBuild, withFakeServe } from "./test_utils.ts"; -import { assertStringIncludes } from "./deps.ts"; +import { assert, assertStringIncludes } from "./deps.ts"; Deno.test("TailwindCSS - dev mode", async () => { await withFakeServe("./tests/fixture_tailwind/dev.ts", async (server) => { const res = await server.get("/styles.css"); const content = await res.text(); assertStringIncludes(content, ".text-red-600"); + + const res2 = await server.get("/styles.css?foo=bar"); + const content2 = await res2.text(); + assert(!content2.includes("@tailwind")); }, { loadConfig: true }); });