[英]Why isn't Tailwind CSS connecting in my react app?
I am attempting to install tailwind (Which I have done many times before with no issue).我正在尝试安装 tailwind(我之前已经做过很多次了,没有问题)。 Please help me with what I am missing this time around.
请帮我解决这次我缺少的东西。
tailwind.config.js tailwind.config.js
module.exports = {
content: [
"./src/**/*.{js,jsx,ts,tsx}",
],
theme: {
extend: {},
},
plugins: [],
}
Package.json Package.json
....
"devDependencies": {
.....
"autoprefixer": "^10.4.2",
"postcss": "^8.4.6",
"tailwindcss": "^3.0.23"
},
....
index.js索引.js
import './index.css'
import React from 'react'
import ReactDOM from 'react-dom'
import App from './App'
ReactDOM.render(<App />, document.getElementById('root'))
app.js应用程序.js
const App = () => {
return <div className='bg-blue-300'>
cool
</div>
}
And lastly (where I believe my problem is) index.css最后(我认为我的问题是)index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
body{
background-color: red; /* I WORK FYI! */
}
(EDIT) A bit more info: This app is the 'example-app' generated after running using create-react-library
. (编辑)更多信息:此应用程序是使用
create-react-library
运行后生成的“示例应用程序”。 I just created a brand new react app, installed TW, and had no problems.我刚刚创建了一个全新的 React 应用程序,安装了 TW,没有任何问题。 I also installed another package into my example-app (react-icons) just to test that wasn't the issue but that works as expected.
我还在我的示例应用程序 (react-icons) 中安装了另一个 package 只是为了测试这不是问题但按预期工作。
Do you start the Tailwind CLI build process?您是否开始 Tailwind CLI 构建过程?
npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.