Ajay Yadav
Ajay Yadav

@ATechAjay

16 Tweets 7 reads Jul 19, 2022
Introduction & Installation to Tailwind CSSโšก
A Thread ๐Ÿงตโ†“
๐Ÿ’ก Tailwind CSS?
โ—“ Tailwind CSS is a utility-first CSS framework, it provides low-level utility classes to build custom web pages.
โ—“ Utility classes are the name of the class according to their purpose such that a developer can easily understand.
โ—“ Like: ๐—ฏ๐—ด-๐—ฟ๐—ฒ๐—ฑ-๐Ÿฑ๐Ÿฌ๐Ÿฌ is the name of the utility class.
- The primary purpose of the ๐—ฏ๐—ด-๐—ฟ๐—ฒ๐—ฑ-๐Ÿฑ๐Ÿฌ๐Ÿฌ class is to add a background color of red, and many more utility classes are available in the Tailwind CSS.
โ—“ We do not need to leave the HTML file for designing the web page.
โ—“ That's why if we want to build a web page the fastest and the easiest way then we should give a try to Tailwind CSS.
๐Ÿ’ก Installation of Tailwind CSS using CLI?
โ—“ You can install it by following these steps, but you can be stuck during installing it.
โ—“ So you should follow these key points during installing Tailwind CSS into your machine.
tailwindcss.com
โ›” First of all, we have to install node JS into our system then we will be able to install Tailwind CSS.
1๏ธโƒฃ Open a folder in VS Code and run the "npm init -y" command in the VS Code terminal.
2๏ธโƒฃ Create 2 folders in that project folder, I've also created 2 folders named "src" and "public" inside that existing folder.
โ—“ Now we have to create some files in both folders.
โ—“ The "public" folder has 2 files that are "index.html" and "output.css"
โ—“ And the "src" folder has only one file that is "input.css"
3๏ธโƒฃ Now we have to download Tailwind CSS using "npm install -D tailwindcss" command.
4๏ธโƒฃ Then we have to create a config file using the "npx tailwindcss init" command.
5๏ธโƒฃ Now we have to add the path as the value of the content property inside the "tailwind.config.js" file.
๐—ฐ๐—ผ๐—ป๐˜๐—ฒ๐—ป๐˜: ["./๐˜€๐—ฟ๐—ฐ/*/.{๐—ต๐˜๐—บ๐—น,๐—ท๐˜€}"],
๐Ÿ’ก One thing kept in mind is that we have to specify the actual path of the" index.html" or " .js " files.
โ—“ My index.html file is kept inside the public folder that's why I have to change path "src" to the "public" in the "tailwind.config.js" file.
โ—“ Both are must be the same otherwise it does not work.
6๏ธโƒฃ Then we have to add these lines of code into a CSS file that is kept inside the src folder.
@๐˜๐—ฎ๐—ถ๐—น๐˜„๐—ถ๐—ป๐—ฑ ๐—ฏ๐—ฎ๐˜€๐—ฒ;
@๐˜๐—ฎ๐—ถ๐—น๐˜„๐—ถ๐—ป๐—ฑ ๐—ฐ๐—ผ๐—บ๐—ฝ๐—ผ๐—ป๐—ฒ๐—ป๐˜๐˜€;
@๐˜๐—ฎ๐—ถ๐—น๐˜„๐—ถ๐—ป๐—ฑ ๐˜‚๐˜๐—ถ๐—น๐—ถ๐˜๐—ถ๐—ฒ๐˜€;
โ—“ In my case, these lines of code are kept inside the input.css file(src f).
7๏ธโƒฃ Now we have to write our code into the "index.html" file and the "output.css" file will be linked to it.
8๏ธโƒฃ Finally, we have to run "npx tailwindcss -i ./src/input.css -o ./public/output.css --watch" command into the terminal.
โ—“ It's a path of those files that are kept inside both folders.
โ—“ The output.css file is kept inside the public folder and the input.css file is kept inside the src folder.
โ—“ After running this command Tailwind CSS is installed successfully into your machine.
๐Ÿ‘€ Finale file structure:
๐Ÿ”” One more thing, you can download this VS Code extension for the code suggestion.
๐Ÿ˜ Tailwind CSS IntelliSense:-
marketplace.visualstudio.com
That's all for now, we will meet in the next thread๐Ÿ˜
๐Ÿ”” Follow Me @ATechAjay
For:
๐ŸŒ Web Development
โœจ JavaScript
๐Ÿ“ Writing Skill
๐Ÿ”ฅ Motivation
๐Ÿ’น Growth
โ›” But Not For Only Resources & Shitpost ๐Ÿ˜
Thank you so much for staying to the end of this thread๐Ÿ’š

Loading suggestions...