TailwindCSS in browser not updated after modifying class
P粉322106755
P粉322106755 2023-08-18 09:24:44
0
1
531
<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粉322106755
P粉322106755

reply all(1)
P粉343408929

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template