Install Tailwind CSS as a PostCSS Plugin with JIT mode enabled (Latest Version v2.2)

  Рет қаралды 5,793

Thirus

Thirus

Күн бұрын

This video demonstrates how to install Tailwind CSS in a brand new project as a PostCSS plugin - with no other frameworks. It's the latest version 2.2 as of recording this video. You will also understand how to enable JIT mode, watch your files during development and optimize & minimize your code for production.
Windows users, please change the "build" script to:
"build": "set TAILWIND_MODE=watch&postcss tailwind.css -o ./public/styles.css -w --verbose"
Thanks to Juan Carlos for pointing out the solution in comments.
Boilerplate on GitHub:
github.com/Thi...
--------
The video is sponsored by Showwcase. Join me there - www.showwcase....
--------
In case you are on Windows and face an error "NODE_ENV is not recognised...", you must install win-node-env. So just run:
npm install win-node-env
Subscribe and stay tuned for tips, tutorials and more.
Follow me on Twitter: / shrutibalasa
Follow Thirus on Twitter: / thirusofficial
Visit my website: www.shrutibala...

Пікірлер: 88
@knowledgely7540
@knowledgely7540 2 жыл бұрын
Thank you ma'am much needed video.
@Thirus
@Thirus 2 жыл бұрын
You’re welcome!
@misadesign
@misadesign 3 жыл бұрын
I'm so lucky to watch this video!
@Thirus
@Thirus 3 жыл бұрын
Happy to know that :)
@gayathrithedev
@gayathrithedev 3 жыл бұрын
Another great resource 🔥 🔥 🔥. Thanks a lot
@parkerrex
@parkerrex 3 жыл бұрын
Found you on twitter. Tailwinds great. I used it in my jamstack site.
@parkerrex
@parkerrex 3 жыл бұрын
newly subbed,
@Thirus
@Thirus 3 жыл бұрын
Awesome! I totally love it (I know it’s evident 😀)
@Josehernandezl
@Josehernandezl 3 жыл бұрын
Thanks Thirus, you are the best!
@Thirus
@Thirus 3 жыл бұрын
Aww thanks!!
@kiranwicksteed3972
@kiranwicksteed3972 3 жыл бұрын
You are awesome
@Thirus
@Thirus 3 жыл бұрын
Thank you ☺️
@missyh3
@missyh3 3 жыл бұрын
Thank you! This really helped!
@Thirus
@Thirus 3 жыл бұрын
You’re welcome :)
@cesarrotela
@cesarrotela 3 жыл бұрын
What is the difference between NODE_ENV=development and TAILWIND_MODE=watch ? The second option does not work for me in windows
@Thirus
@Thirus 3 жыл бұрын
When you set the mode to watch, Tailwind automatically builds everytime you save your files. It works on windows if you install cross-env npm package
@cesarrotela
@cesarrotela 3 жыл бұрын
@@Thirus Thank you so much!
@savy5435
@savy5435 3 жыл бұрын
Please help me, I have been trying to get this up and running for days now with no progress, it keeps saying TAILWIND_MODE and postcss isn't an internal command, it's frustrating, someone please help me out, I don't know what to do again 🙏 😔
@Thirus
@Thirus 3 жыл бұрын
Are you using Windows? Please check the readme file on the GitHub repository to make necessary changes for Windows
@savy5435
@savy5435 3 жыл бұрын
@@Thirus thank you for your reply, found another way tho but I haven't applied jit to it yet
@savy5435
@savy5435 3 жыл бұрын
@Wildan Alif R thank you
@neerajsinghtangariya2587
@neerajsinghtangariya2587 3 жыл бұрын
In my system your boilerplate is not working means some tailwind class is not working. I did fresh install and install your boilerplate also. can you plz tell what was the reason. And I'm using window os
@Thirus
@Thirus 3 жыл бұрын
Do you see any error? Can you send some screenshots on Twitter - twitter.com/shrutibalasa
@neerajsinghtangariya2587
@neerajsinghtangariya2587 3 жыл бұрын
@@Thirus No error. That is weird I don't know why this is not working. But now for learing tailwindcss I'm using other alternative which is Nextjs. Now tailwind is working properly in Nextjs.
@wieN4rn0
@wieN4rn0 3 жыл бұрын
I have copied your boilerplate tailwindcss with JIT mode. I want to upload my website to server. What should I do? Can I just copy files inside public folder?
@Thirus
@Thirus 3 жыл бұрын
Run the production script once. It will even minify your CSS. After that, yes. Just copy the public folder
@wieN4rn0
@wieN4rn0 3 жыл бұрын
@@Thirus Thank you very much for your response...
@arpanchaudhuri8486
@arpanchaudhuri8486 3 жыл бұрын
Thank You Very Much
@Thirus
@Thirus 3 жыл бұрын
You’re welcome :)
@s7s_space
@s7s_space 3 жыл бұрын
You should update your repo to windows users ? what is the benefits here of using postcss ? it's for prefix or what ??
@marcelnunez1658
@marcelnunez1658 3 жыл бұрын
Can you make a video on importing local fonts in tailwind?
@MrCC-hx8xr
@MrCC-hx8xr 3 жыл бұрын
Hi, excelent recipe. Everythink works fine, but TAILWIND_MODE=watch nope. Im on WIN 10. My code: "dev:tw:watch": "TAILWIND_MODE=watch postcss --env dev ./assets/css/app.scss -o ./assets/css/app.dev.css --watch --verbose", And i get error message ''TAILWIND_MODE' is not recognized as an internal or external command, operable program or batch file' Without TAILWIND_MODE everything works fine with JIT mode, but dont watch the "purge file", so i have the npm build run manually = its boring. Any suggestion?
@MrCC-hx8xr
@MrCC-hx8xr 3 жыл бұрын
SOLVED with cross-env module!
@C00ltronix
@C00ltronix 2 жыл бұрын
Does it work the same way in Tailwind 2.2? When I build I get "npm ERR! code ELIFECYCLE"
@Thirus
@Thirus 2 жыл бұрын
Did you try cloning my repo? Do you get the same error?
@C00ltronix
@C00ltronix 2 жыл бұрын
@@Thirus I didn't clone (this time). When I clone the repo I can just start, or do I need to init something? Anyway, now I did this video line by line = fine ;-) - only one tiny tiny issue, on Windows you also need to change: "prod": "set NODE_ENV=production&postcss tailwind.css -o ./public/styles.css" Let's see if I can manage to use this for Hugo.... I have actually one more question - if I have custom css, where I put them? In tailwind.css ?
@Thirus
@Thirus 2 жыл бұрын
Yes, tailwind.css Glad it worked
@slackergeek2007
@slackergeek2007 3 жыл бұрын
Which Live Server are you using and is it working? I tried the one by Ritwick Dey, but it appears to be broken and not auto refreshing changes, even though the browser window flashes, like it was re-syncd. Anyway, I had to use Five Server, instead.
@Thirus
@Thirus 3 жыл бұрын
Yea that’s the one. Usually works for me
@hasibulhasansiju
@hasibulhasansiju 3 жыл бұрын
"liveServer.settings.fullReload": true by default live server just injects the css. so you need to enable the full reload to get it working with tailwind. because when tailwind is generating the css file live server replaces it with the one in cache. Five server fully reloads by default.
@slackergeek2007
@slackergeek2007 3 жыл бұрын
@@hasibulhasansiju thanks, I'll give that a try
@hi-yi7en
@hi-yi7en 3 жыл бұрын
👍👍...
@codedjango
@codedjango 3 жыл бұрын
I am trying to use tailwind css in my Vue project....there is already a "serve" script which I use to run the code in development (command: "npm run serve")...now how do I add your "build" script in my "serve" script so that it compiles the tailwind and runs the project BOTH at the same time? OR Do I have to write a separate script? But then it becomes tedious n inconvenient? Any solution to this? The official "tailwind" docs doesn't help but your build script at least got it working....probably because you installed "postcss-cli" instead of "postcss" which is shown in official docs. Please reply - I m stuck on this
@Thirus
@Thirus 3 жыл бұрын
Did you try this - kzbin.info/www/bejne/rZvYqIuviNipeNk ?
@yukiryu8530
@yukiryu8530 2 жыл бұрын
Hi. I try install tailwind via npm like in the documentation, after the installation finished why only package.json is missing? I try that in laragon local server and maybe permission problem or something else i don't know. I try again in document/new_folder and when finished in terminal it said finished but nothing added. Why is like that and how to fix it?
@Thirus
@Thirus 2 жыл бұрын
Wait, are you trying to install Tailwind CSS in your Laravel project?
@yukiryu8530
@yukiryu8530 2 жыл бұрын
@@Thirus no. Just static website. I want to make portfolio website. Usually i make any website in laragon local server folder (www) so i can found all my website i create in there. Update: Finally i can install and config all colors in tailwindcss v.2. because this is the first time i use tailwindcss and i just learned from tailwind labs youtube channel this 2 days. And what make my stack longer maybe my keyword not right because of that so hard to find similar problem and the answer in internet. Because usually i use BS.
@Thirus
@Thirus 2 жыл бұрын
So you finally got it working right? That’s great
@yukiryu8530
@yukiryu8530 2 жыл бұрын
@@Thirus yes. But with minimum documentation or reference about the components it's so hard for me only to make responsive header with dark mode toggle. From what i feel, it's not easy for beginner. So i decide back to BS again. Thank you for replying my question
@sudipjs
@sudipjs 3 жыл бұрын
this jit configuration is use for react js or not
@Thirus
@Thirus 3 жыл бұрын
It’s different for React
@sudipjs
@sudipjs 3 жыл бұрын
What I do to achieve that
@Thirus
@Thirus 3 жыл бұрын
Have you been able to install tailwind in react without jit mode?
@Borma425
@Borma425 3 жыл бұрын
thanks
@Thirus
@Thirus 3 жыл бұрын
Welcome!
@masoodahmed7502
@masoodahmed7502 3 жыл бұрын
Mam a followed your all steps correctly and in the last step which you run npm run build at the time it's showing Input error: You must pass a valid list of files to parse
@Thirus
@Thirus 3 жыл бұрын
Did you try cloning the github repository? Did that work? If that works, then compare yours with that
@masoodahmed7502
@masoodahmed7502 3 жыл бұрын
@@Thirus Thanks mam that github repository code it's working
@jbraddockm
@jbraddockm 3 жыл бұрын
Thank you for this. I was wondering if you have a tutorial that additionally shows how to integrate and compile scss files as well as to use Tailwind JIT with WordPress? I couldn’t find an up to date tutorial that address these two questions. Thx.
@stephenlau2845
@stephenlau2845 3 жыл бұрын
Hi, Thanks ur Tutorial, What are the different between the method to install Tailwind Css, npm cdn Link and Jit ? Because I found some of function it can not run in npm property before it add the cdn Link...and, Can I use they 3 methods all in a project ?
@Thirus
@Thirus 3 жыл бұрын
CDN is limited. You can’t customise tailwind to your needs. Installing without ‘jit’ mode is totally fine - gives you all features but during development, the css file is very huge which might give some problems in browser With ‘jit’ mode, your development css file is also very small to work with. And you also get to use some custom values without first configuring them.
@sandeshjoshi3981
@sandeshjoshi3981 3 жыл бұрын
Am getting this error please help 'TAILWIND_MODE' is not recognized as an internal or external command
@Thirus
@Thirus 3 жыл бұрын
Remove that part and try again
@jcarlos57
@jcarlos57 3 жыл бұрын
if you are on windows use ... "dev": "set TAILWIND_MODE=watch&postcss tailwind.css -o ./public/styles.css -w --verbose"
@Thirus
@Thirus 3 жыл бұрын
Thanks Juan. @Sandesh - Does this work for you?
@jcarlos57
@jcarlos57 3 жыл бұрын
@@Thirus in windows we use the command "set" to create a "environment variable" with a "value" and the character "&" to separate two commands in a single line. I have tried "dev": "set TAILWIND_MODE=watch&postcss tailwind.css -o ./public/styles.css -w --verbose" .. and .. "prod": "set NODE_ENV=production&postcss tailwind.css -o ./public/styles.css --verbose" both works fine.
@sandeshjoshi3981
@sandeshjoshi3981 3 жыл бұрын
@@Thirus Its working now...thank you
@jantu_dev
@jantu_dev 3 жыл бұрын
So, we don't need to purge css ?
@Thirus
@Thirus 3 жыл бұрын
Not anymore
@ragjnmusic8765
@ragjnmusic8765 Жыл бұрын
will this work for Intellij IDEA?
@Thirus
@Thirus Жыл бұрын
This is an old video. Please check the latest one.
@stefanocons
@stefanocons 3 жыл бұрын
Fantastic video! Thank you so much!
@Thirus
@Thirus 3 жыл бұрын
You’re welcome 😊
Light & Dark Mode toggle using Tailwind CSS & Alpine JS
19:30
Girl, dig gently, or it will leak out soon.#funny #cute #comedy
00:17
Funny daughter's daily life
Рет қаралды 68 МЛН
Пришёл к другу на ночёвку 😂
01:00
Cadrol&Fatich
Рет қаралды 10 МЛН
What's New in Tailwind CSS v2.2
21:21
Tailwind Labs
Рет қаралды 51 М.
Install Tailwind CSS as a PostCSS Plugin (Version 2.0)
8:39
Install Tailwind CSS v3 - CDN vs CLI vs PostCSS
34:19
Thirus
Рет қаралды 31 М.
Subgrid in Tailwind CSS - You didn’t know you needed this
14:12
Just-In-Time: The Next Generation of Tailwind CSS
13:18
Tailwind Labs
Рет қаралды 158 М.
What's new in Tailwind CSS v3.0?
26:33
Tailwind Labs
Рет қаралды 183 М.
Theming Tailwind with CSS Variables
27:24
Tailwind Labs
Рет қаралды 125 М.