首页  >  问答  >  正文

修改类后,浏览器中的TailwindCSS未更新

<p>我正在使用React运行Tailwind,但为了看到我对classNames所做的更改,我必须重新启动服务器并再次运行<code>npm run start</code>才能看到更新。 有没有什么我需要在我的脚本中更改的地方,这样浏览器就不需要重新启动服务器就能更新。</p> <h5>package.json</h5> <pre class="brush:json;toolbar:false;">"scripts": { "start": "npm run build:css && react-scripts start", "build": "npm run build:css && react-scripts build", "test": "react-scripts test", "eject": "react-scripts eject", "build:css": "postcss src/CSS/tailwind.scss -o src/CSS/index.scss " } </pre> <h5>tailwind.config.js</h5> <pre class="brush:js;toolbar:false;">/**@type {import('tailwindcss').Config}*/ module.exports = { content: [ './app/**/*.{js,ts,jsx,tsx}', './页/**/*.{js,ts,jsx,tsx}', './components/**/*.{js,ts,jsx,tsx}', './src/**/*' ], theme: { extend: {}, }, plugins: [], }; </pre> <h5>postcss.config.js</h5> <pre class="brush:js;toolbar:false;">module.exports = { plugins: { tailwindcss: {}, autoprefixer: {}, }, } </pre> <p>我用<code>npm-run-all</code>试过了,但没有成功。还有其他建议吗?</p>
P粉322106755P粉322106755399 天前428

全部回复(1)我来回复

  • P粉343408929

    P粉3434089292023-08-19 00:07:36

    你是用Create React App生成的React项目,对吗?为什么不按照这个过程来做呢?postcss会为你更新最新的实现。

    回复
    0
  • 取消回复