How to use Tailwind CSS with Yew?

I have tried to follow the steps described in to make use of Tailwind CSS in Yew, but it doesn't work.

My test project folder:

enter image description here


name = "yew-tailwind-app"
version = "0.1.0"
edition = "2021"

yew = { version = "0.19" }


<!DOCTYPE html>
<html lang="en">
        <link data-trunk href="./tailwind.css" rel="css" />


The codes in

use yew::prelude::*;

fn app() -> Html {
    html! {
            <h1>{ "Hello World" }</h1>
            <p class={ classes!("bg-red-500") }>{"Test!"}</p>

fn main() {

But I don't see the red background color in "Test!". Can you help?

enter image description here


  • I had the same problem. did as it says here . I took tailwind.css from the output directory and put it in the root of the project.