Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tailwind 4 #2819

Open
gawhite opened this issue Jan 29, 2025 · 6 comments · May be fixed by #2829
Open

Tailwind 4 #2819

gawhite opened this issue Jan 29, 2025 · 6 comments · May be fixed by #2829

Comments

@gawhite
Copy link

gawhite commented Jan 29, 2025

Any Guidance on updating to / using Tailwind 4 with Fresh?

@rocklau
Copy link

rocklau commented Feb 10, 2025

Here. https://github.com/rocklau/fresh-daisyuiv5-demo

dev.ts

#!/usr/bin/env -S deno run -A --watch=static/,routes/

import dev from "$fresh/dev.ts";
import config from "./fresh.config.ts";
import autoprefixer from "autoprefixer";

import "$std/dotenv/load.ts";
import postcss from "postcss";
import tailwindcss from "@tailwindcss/postcss";

const css = Deno.readTextFileSync("./static/app.css");
const out = await postcss([tailwindcss, autoprefixer]).process(css, {
  from: "./static/app.css",
});
Deno.writeTextFileSync("./static/styles.css", out.css);

await dev(import.meta.url, "./main.ts", config);
``

@Bentheminernz
Copy link

Bentheminernz commented Feb 13, 2025

I followed the configuration for your git repo and even cloned it yet I always get this error. Any ideas?

error: Uncaught (in promise) Error: Can't resolve 'tailwindcss' in '/Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/static'
    at finishWithoutResolve (file:///Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/node_modules/.deno/[email protected]/node_modules/enhanced-resolve/lib/Resolver.js:564:18)
    at file:///Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/node_modules/.deno/[email protected]/node_modules/enhanced-resolve/lib/Resolver.js:656:15
    at file:///Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/node_modules/.deno/[email protected]/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (file:///Users/[USERNAME]/Documents/GitHub/TypeScript%20Learning/react-learning/node_modules/.deno/[email protected]/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at file:///Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/node_modules/.deno/[email protected]/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (file:///Users/[USERNAME]/Documents/GitHub/TypeScript%20Learning/react-learning/node_modules/.deno/[email protected]/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at file:///Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/node_modules/.deno/[email protected]/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:89:43
    at file:///Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/node_modules/.deno/[email protected]/node_modules/enhanced-resolve/lib/Resolver.js:718:5
    at eval (eval at create (file:///Users/[USERNAME]/Documents/GitHub/TypeScript%20Learning/react-learning/node_modules/.deno/[email protected]/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at file:///Users/[USERNAME]/Documents/GitHub/TypeScript Learning/react-learning/node_modules/.deno/[email protected]/node_modules/enhanced-resolve/lib/Resolver.js:718:5

@rocklau
Copy link

rocklau commented Feb 13, 2025

you need to build first

deno task build
deno install --allow-import -e main.ts

@clearfram3
Copy link

Since tailwind has lightningcss built-in, if you use tailwind, is autoprefixer still needed?

@shuliangfu
Copy link

This is inconvenient, waiting for the official upgrade to V4

@pakornv
Copy link

pakornv commented Feb 21, 2025

I made the package for this. Feel free to copy it to your project while you wait for the official implementation
https://jsr.io/@pakornv/fresh-plugin-tailwindcss

@AugustinMauroy AugustinMauroy linked a pull request Feb 23, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants