简体   繁体   English

为什么 Tailwind CSS 没有连接到我的 React 应用程序中?

[英]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.

相关问题 为什么“disabled:”tailwind 前缀在我的 React 应用程序中不起作用? - Why isn't the "disabled:" tailwind prefix working in my react app? Tailwind CSS 3 未在我的 React 应用程序中应用 - Tailwind CSS 3 is not being applied in my React app 在我的 React 应用程序中,为什么没有执行这个 Redux reducer? - In my React app, why isn't this Redux reducer executed? 为什么录像不能在我的React-app中工作? - Why isn't video recording working in my React-app? 为什么我的 React 应用程序没有显示在 GitHub Pags 中? - Why isn't my React app showing in GitHub Pags? 为什么我的 React 应用登录后没有重定向到主页? - Why isn't my react app redirecting to home after login? 为什么我的 setInterval function 没有在这个 React 应用程序中被调用? - Why isn't my setInterval function being called in this React app? 为什么我的 React 应用程序没有部署在 GitHub 上 - Why isn't my React app deploying on GitHub 为什么我的时间选择器在使用 React 和 Tailwind CSS 时不起作用? - Why does my timepicker do not work using React and Tailwind CSS? 为什么我的自定义 Tailwind CSS 实用程序不适用于 React 元素? - Why is my custom Tailwind CSS utility not applying to React elements?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM