iamarsenibragimov's avatar

Some Tailwind CSS classes are not working in my new Laravel 9 project

Hey!

I've just started my new Laravel project and would like to use Tailwind CSS so I go for a button like this

<button class="bg-black p-2 rounded">Click me</button>

which I expect to be a back button but I see this instead

[there supposed to be an image but I've registered just today]

So it is the button without a background.

What am I doing wrong?

0 likes
5 replies
Sinnbeck's avatar

Did you run npm run dev?

And welcome to the forum :)

1 like
iamarsenibragimov's avatar

@Sinnbeck oh wow. It works. Thx!

Last time I used Laravel 6 and not tailwind and I didn't have to run this command every time I wanted to see changes in a project.

Shall I use the command every time or there is another flow available?

Lara_Love's avatar

@iamarsenibragimov

Start your build process : Run your build process with npm run dev or whatever command is configured in your package.json file.

1 like
Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@iamarsenibragimov You have 2 commands now

For dev you do npm run dev. Start this whenever you need to work on css/js or anything like that (adding classes). This does not store anything to disk. It just runs a dev server that injects the changes in realtime

For production do npm run build. This compiles the css/js to actual files (like you are used to from mix). You can also run this locally when you are done working with css/js for the day, to not have to run npm run dev next time you need to work, if you only plan to work on backend stuff

Hope that makes sense

If the issue is solved, please mark a best answer :)

1 like

Please or to participate in this conversation.