Ris*_*war 5 reactjs tailwind-css
我尝试使用本指南安装 tailwindcss 3.0.1,但是当我将 tailwindcss 类添加到我的反应代码中时,它不起作用。我按照本指南集成 tailwind 进行反应:https://tailwindcss.com/docs/guides/create-react-app
我使用npx creat-react-app myApp而不是创建了一个反应应用程序npx create-react-app@next --scripts-version=@next --template=cra-template@next my-project
任何人请帮我解决这个问题。
我尝试了很多解决方案,看来为了成功使用Reactwith Tailwindcss V3.0.1,安装中的第一行至关重要:
npx create-react-app@next --scripts-version=@next --template=cra-template@next my-project
Run Code Online (Sandbox Code Playgroud)
但我找到了简单的解决方案,像文档中那样安装所有内容,并将此行添加到您的文件夹index.html中Public。它可以工作,但是仅用于开发目的!
<script src="https://cdn.tailwindcss.com"></script>
Run Code Online (Sandbox Code Playgroud)
像这样:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<title>React App</title>
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2866 次 |
| 最近记录: |