question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

No rebuild css in jit mode using watch on postcss 7

See original GitHub issue

What version of Tailwind CSS are you using?

v2.2.7

What build tool (or framework if it abstracts the build tool) are you using?

postcss 7

What version of Node.js are you using?

14.17.3

What browser are you using?

N/A

What operating system are you using?

Windows 10

Reproduction repository

https://github.com/huibizhang/create-react-app

Describe your issue

This problem is occurring at postcss 7 environment, like Vue-CLI and Create React App.

Tailwind’s version over 2.1.4 and come to 2.2, use following steps of document Installation to install and setup jit mode are invalid.

When add a new class after tailwind first build on dev server opened, it not works. I have to reopen dev server, and the class well be actived.

For example: on cra, use following step to setup jit mode with tailwind 2.1.4, its running very well. But, when everything as same as 2.1.4 that I do, just tailwind version comes to 2.2, jit’s rebuild is not working.

Ummm … I’m trying to use tailwindcss-cli to watch files and include output file in js

tailwindcss-cli -i tailwind.css -o index.css -w

It works, but tailwindcss-cli dependent postcss 8, but project just can using postcss 7, I’m worry that maybe something will getting wrong in feature.

That’s all my questions, thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:4
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
huibizhangcommented, Aug 6, 2021

@adamwathan , @shantiscript thanks a ton. I find the solution for this.

on postcss 7, set enviornment variables TAILWIND_MODE=watch can prefectally work.

  "scripts": {
+   "start": "cross-env TAILWIND_MODE=watch craco start",
    "build": "craco build",
    "test": "craco test",
    "eject": "react-scripts eject"
  },

linux based can only "start": "TAILWIND_MODE=watch craco start" but I’m using Windows, so I need to install package cross-env, cross-env also can works on linux based. It’s same problem on vue-cli 4, and this solution can resolved too.

This is my test: https://github.com/huibizhang/create-react-app/tree/resolved

1reaction
SebasScriptcommented, Aug 3, 2021

just had the same issue setting up a new create-react-app. In jit mode new classes where only added when restarting the node dev server. Downgrading Taiwlind to below 2.1.4 solved the issue for now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Just-in-Time Mode - Tailwind CSS
This library can compile even the biggest projects in about 800ms (with incremental rebuilds as fast as 3ms), no matter what build tool...
Read more >
Why styles don't update when saving the files in Tailwind CSS ...
While trying to use Tailwind with React in JIT mode the classes that I add have no styles, even after refreshing the page....
Read more >
How to trigger a resource re-build on every change/server ...
This worked great with AOT design but not with JIT since the CSS needs to be rebuilt on almost every template change without...
Read more >
Master Tailwind CSS With Its Just-in-Time (JIT) Mode - Kinsta
Learn all the ins and outs of Tailwind CSS JIT mode, which is its Just-In-Time compilation feature. It's sure to speed up your...
Read more >
Tailwind's JIT Compiler Makes Tailwind + Webpack Faster in ...
We'll go from 6 second load times to ~1 second or less for most CSS updates without any caching.Hit the subscribe button to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found