Home  >  Q&A  >  body text

TailwindCSS in browser not updated after modifying class

<p>I'm using React to run Tailwind, but in order to see the changes I made to classNames, I have to restart the server and run <code>npm run start</code> again to see the updates. Is there anything I need to change in my script so that the browser updates without needing to restart the server. </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}', './pages/**/*.{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>I tried using <code>npm-run-all</code> without success. Any other suggestions? </p>
P粉322106755P粉322106755450 days ago479

reply all(1)I'll reply

  • P粉343408929

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

    You used Create React App to generate the React project, right? Why not follow this process? postcss will update the latest implementation for you.

    reply
    0
  • Cancelreply