Cons with JIT (and some things that blew my mind) #4221
jenstornell
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Cons with JIT
JIT + Gulp + 1 terminal = Fails
JIT is a watcher. Gulp is also a watcher. I use Gulp just to merge and compress JS-files on save. Using JIT and Gulp in the same terminal is not possible from what I know.
However, if using VSCode, you can split the Terminal into two termnials. In one you run JIT and in the other you run Gulp. Then they watch the files independent of eachother. It works surprisingly good, great actually. So this is no longer a con if you know how to fix it.
Poor docs
I'm really not an expert on Node or environments in general. So far I'm not impressed by the docs about JIT. I tried it out but failed.
To have JIT successfully installed I used a brilliant tutorial on Youtube: https://youtu.be/lYWQdxHGnkc. Maybe do something similar both in the docs but maybe as an own Youtube video?
Styles are not removed
Because of performance, JIT does not remove styles that are removed from the HTML. For a perfectionist, it's a nag at first. When used to it, it's not that big of a problem. If you save the tailwind.css file your unused styles will be removed. You can also restart the JIT watcher. Is it a nag? Performance is more important and this nag is a minor one.
Bonus - What made me happily surpriced
To see all the benefits of JIT read on the website.
There are however some pros that I think is missing in that list.
Postcss-import just works
I had a reason to import an external CSS file. With postcss-import it inject the CSS from the imported file into the output CSS file as well as convert all the @apply stuff to real CSS.
I was surpriced that it also works without hassle with JIT. Not only that, it's also aware of the files I've imported so if I save an imported file, JIT does the job perfectly.
Maybe it's the expected behaviour, but to me that blew my mind.
Changing tailwind.config.js is less of a hassle
The JIT watcher does not only watch the HTML files, it also watches the tailwind.config.js file. It makes it much more user friendly. We no longer needs to manually compile everything again when changing the tailwind.config.js. For me personally it means that I use it much more often than before, because it's no longer an obsticle.
Is JIT the future of Tailwind? YES!
Beta Was this translation helpful? Give feedback.
All reactions