我尝试按照 https://dev.to/arctic_hen7/how-to-set-up-tailwind-css-with-yew-and-trunk-il9 中所描述的步骤在 Yew 中使用 Tailwind CSS,但是并没有成功。
我的测试项目文件夹如下所示:
Cargo.toml:
我的测试项目文件夹如下所示:
![enter image description here](https://istack.dev59.com/g0FOd.webp)
[package]
name = "yew-tailwind-app"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
yew = { version = "0.19" }
index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<link data-trunk href="./tailwind.css" rel="css" />
</head>
<body>
</body>
</html>
main.rs中的代码:
use yew::prelude::*;
#[function_component(App)]
fn app() -> Html {
html! {
<>
<h1>{ "Hello World" }</h1>
<p class={ classes!("bg-red-500") }>{"Test!"}</p>
</>
}
}
fn main() {
yew::start_app::<App>();
}
但是我在“测试!”中看不到红色背景颜色。你能帮忙吗?