2

I'm creating a react app using bun.sh.

But I also use tailwindcss for styling and tailwind has no official solution for bun. How can use these two together?

I know bun is not ready for production but I'm still looking for a solution if its possible.

Tobias S.
  • 21,159
  • 4
  • 27
  • 45

3 Answers3

7

You can run a javascript file (or a package.json script or a bin file) with using bun run followed by the library name.

In your case, first add the tailwindcss package to your project: bun add -d tailwindcss

Then initialize tailwind css like this bun run tailwindcss init

This should add the tailwind.config.js file to your project.

tirupats
  • 158
  • 1
  • 10
4

To use Tailwind with bun, use the Tailwind CLI and import the processed .css file. Learn more: https://tailwindcss.com/docs/installation

npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch

or

bun tailwindcss -i ./src/input.css -o ./dist/output.css --watch
bun run tailwindcss -i ./src/input.css -o ./dist/output.css --watch

Use that output.css in your main file and done!

0

use CLI instation methode using npx or npm it

https://tailwindcss.com/docs/installation

dodo
  • 9
  • 2