<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: vishnu prasad</title>
    <description>The latest articles on DEV Community by vishnu prasad (@vishnup95).</description>
    <link>https://dev.to/vishnup95</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F197301%2F7f93517b-ddc0-4166-abe4-0dde125efd95.jpeg</url>
      <title>DEV Community: vishnu prasad</title>
      <link>https://dev.to/vishnup95</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vishnup95"/>
    <language>en</language>
    <item>
      <title>Let's build a simple Node.js CLI application</title>
      <dc:creator>vishnu prasad</dc:creator>
      <pubDate>Sun, 22 Aug 2021 19:28:08 +0000</pubDate>
      <link>https://dev.to/vishnup95/let-s-build-a-simple-node-js-cli-application-1l9c</link>
      <guid>https://dev.to/vishnup95/let-s-build-a-simple-node-js-cli-application-1l9c</guid>
      <description>&lt;p&gt;Hello everyone! Hope you all are staying safe. &lt;/p&gt;

&lt;p&gt;Today, we are going to see how to quickly create a Node.js CLI application. This is a true beginners post. If you have experience creating Node.js CLI applications, then I don't think you will learn more from here. You could always read on and see. You may learn something new. &lt;/p&gt;

&lt;p&gt;Now that's out of the way. Let's begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  What are we building?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;CLI&lt;/strong&gt; is the &lt;strong&gt;Command Line Interface&lt;/strong&gt;. A better understanding would be obtained by calling it terminal on your computer. CLI apps are apps that run on the terminal. Minimal visual effect, maximum efficency and productivity is the tagline of CLI apps. &lt;/p&gt;

&lt;p&gt;Hmm, I thought about what would be a good introduction to Node.js CLI Application.  One of the most used CLI commands would be the &lt;code&gt;ls&lt;/code&gt; command. Let's reproduce that using Node.js. We will create a &lt;code&gt;nls&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tools of the trade
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Node.js
&lt;/h3&gt;

&lt;p&gt;Node.js is a JavaScript runtime in the terminal (or outside of the browser). It's a wonderful piece of technology that allows JavaScript developers to create fully featured backend systems with their exisiting JavaScript knowledge.  Read more &lt;a href="https://nodejs.org/en/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  npm - Package Manager
&lt;/h3&gt;

&lt;p&gt;A package manager. 1000's of open source packages that you can try and use to build great things. Easy to install and get started, a great tool in the toolbox of any JS developer.&lt;br&gt;
&lt;strong&gt;FUN FACT&lt;/strong&gt; You would think npm stands for &lt;code&gt;Node Package Manager&lt;/code&gt;, that's a misunderstanding most people make. It is actually a recursive bacronymic abbreviation for "npm is not an acronym". &lt;a href="https://github.com/npm/cli" rel="noopener noreferrer"&gt;https://github.com/npm/cli&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think that's it for now. Let's build something. &lt;/p&gt;

&lt;p&gt;First create a folder called nls. &lt;code&gt;cd&lt;/code&gt; into nls. Make sure you have node and npm setup. &lt;/p&gt;

&lt;p&gt;Run &lt;code&gt;npm init -y&lt;/code&gt;. This will create a package.json. This is a config file for your application. It will list the dependencies you have used, names, description and much more. &lt;/p&gt;

&lt;p&gt;Exercise for you: Why did we use &lt;code&gt;-y&lt;/code&gt; ? what happens if we don't. Figure it out.&lt;/p&gt;

&lt;p&gt;The first thing we need to do is to create an &lt;code&gt;index.js&lt;/code&gt; in the nls directory. Cool. &lt;/p&gt;

&lt;p&gt;We can now go into the API Docs of the Node.JS to see what we can use. Visit &lt;a href="https://nodejs.org/dist/latest-v14.x/docs/api/" rel="noopener noreferrer"&gt;Here&lt;/a&gt;. Make sure you are following for the version you have. I am running the 14.x LTS version. So I will use that. The sidebar on the left lists the different standard library and API's available for your node projects. Look through it. You will see something called File System. Load it up. It's a vast vast document. Don't feel overwhelmed. You can go ahead and search for readdir. There are three versions of the &lt;code&gt;readdir&lt;/code&gt; function available for our use. &lt;br&gt;
1) call back based one.&lt;a href="https://nodejs.org/dist/latest-v14.x/docs/api/fs.html#fs_fs_readdir_path_options_callback" rel="noopener noreferrer"&gt;Doc&lt;/a&gt;&lt;br&gt;
2) Synchronous readdir. &lt;a href="https://nodejs.org/dist/latest-v14.x/docs/api/fs.html#fs_fs_readdirsync_path_options" rel="noopener noreferrer"&gt;Doc&lt;/a&gt;&lt;br&gt;
3) promises based one. &lt;a href="https://nodejs.org/dist/latest-v14.x/docs/api/fs.html#fs_fspromises_readdir_path_options" rel="noopener noreferrer"&gt;Doc&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Please read through them. You don't need to understand everything. It would be really good for you to read through it and get an idea of the difference. We will use the callback based one to start with. Although I would probably prefer a promise based approach in a large project. Let's write some code. &lt;/p&gt;

&lt;p&gt;Start by requiring the fs module. ( we could use the ECMAScript module system to have taste of it. It's widely available now and I expect node packages to move to import/export rather quickly.Infact I will write another post on using the new import/export node API soon. See &lt;a href="https://nodejs.org/dist/latest-v14.x/docs/api/esm.html" rel="noopener noreferrer"&gt;more&lt;/a&gt; if you are interested. )&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const fs = require('fs')
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;next we use the readdir function.readdir accepts three arguments. the first one is a path. This is the path of the directory from which you want to read the contents. The second is options objects. It has options like &lt;code&gt;encoding&lt;/code&gt; and &lt;code&gt;withFileType&lt;/code&gt;. Note that. We will use that one. The last is a callback function that will allows us to execute the code we want after readdir runs. The callback accepts two arguments. &lt;code&gt;err&lt;/code&gt; and &lt;code&gt;files&lt;/code&gt;. Okay.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// process.cwd() is the way by which node understands the 
// current working directory. We will change it soon. 
// Give me 2 minutes :)
fs.readdir(process.cwd(), (err, files) =&amp;gt; {
 if(err) {
  console.error('something went wrong!');
  return;
 }
 console.log(files)
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;How do we test it out? Well node makes it easy. Go to your package.json. somewhere in that, without breaking the JSON structure add&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// package.json
// You can replace nls with whatever you want. This is what 
// your ls command is going to be. Get creative. 
"bin": {
  "nls": "index.js"
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;next go back to your index.js and add the shebang to make it executable. Note the shebang should be the first line in your js file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Shebang tells which interpreter to use. We are telling to use node. &lt;/p&gt;

&lt;p&gt;Now in your directory with the package.json run &lt;code&gt;npm install -g .&lt;/code&gt; (npm link is also a alternative)&lt;br&gt;
This should mean you can now &lt;code&gt;nls&lt;/code&gt; on the terminal and see something. Something like &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdvau6n8jbjskkqppwo1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fzdvau6n8jbjskkqppwo1.png" alt="Node - File List"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Exciting. This is an array of the files and folders in the directory. Wohoo. Almost, almost. Note two important points. This is an array. All files are colored in the same green color. Let's work on fixing that. Let's install chalk to color the console outputs. Chalk is terminal styling helper. It provides a simple wrapper to style/color the console logs of your application. &lt;a href="https://www.npmjs.com/package/chalk" rel="noopener noreferrer"&gt;Chalk&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install --save chalk&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now let's use the options object of the &lt;code&gt;readdir&lt;/code&gt; function. &lt;br&gt;
Change the code as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;readdir(process.cwd(), { withFileTypes: true },...
// no changes here..
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;withFileTypes ensures that files that we get back are of class of type &lt;code&gt;fs.Dirent&lt;/code&gt;. This is node file object which has certain properties and methods which are very usual here. &lt;a href="https://nodejs.org/dist/latest-v14.x/docs/api/fs.html#fs_class_fs_dirent" rel="noopener noreferrer"&gt;fs.Dirent&lt;/a&gt;. One of this is a method &lt;code&gt;fs.isDirectory()&lt;/code&gt; that returns a boolean. Like you get from the name. It can be useful to check whether it is directory or not. Let's include that. Modify our callback function as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//index.js

readdir(process.cwd(), { withFileTypes: true }, (err, files) =&amp;gt; {
    if (err) {
        log(chalk('ERROR'));
    }
    files.forEach((file) =&amp;gt; {
        if (file.isDirectory()) {
            log(chalk.blueBright(file.name));
        } else {
            log(chalk.whiteBright(file.name));
        }
    });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Hmm hmm.. Now let's try running it. Save it and type &lt;code&gt;nls&lt;/code&gt; into your terminal. You can see that folders are blue colored and files are white colored. Yay. &lt;/p&gt;

&lt;p&gt;One more change that I wanna make is to accept a argument. &lt;code&gt;ls&lt;/code&gt; can take an argument and list the files and folders in the path. For. eg. in your linux machine. &lt;code&gt;ls /home/{usrname(replace with your usernam)}&lt;/code&gt; can list the files in that directory. Let's add that. &lt;/p&gt;

&lt;p&gt;How can read the arguments passed in the CLI to your file. We can use &lt;code&gt;process.argv&lt;/code&gt; value. Note that &lt;code&gt;process.argv&lt;/code&gt; is an array. The first two values are related to node installation in your system and not much interest to us. Let's accept the third value or &lt;code&gt;process.argv[2]&lt;/code&gt;. Change the code to&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const lsArgs = process.argv[2]

const fileDirectory = lsArgs ? lsArgs : process.cwd();

readdir(fileDirectory, { withFileTypes: true }, (err, files) =&amp;gt; {
    if (err) {
        log(chalk('ERROR'));
    }
    files.forEach((file) =&amp;gt; {
        if (file.isDirectory()) {
            log(chalk.blueBright(file.name));
        } else {
            log(chalk.whiteBright(file.name));
        }
    });
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That was easy. Take the arg if it's present or use the cwd(). Wohoo. We have something. Another improvment is that we can hide the hidden folders from our listing. We can use regex for this check. Something like&lt;/p&gt;

&lt;p&gt;&lt;code&gt;files = files.filter((file) =&amp;gt; !/(^|\/)\.[^\/\.]/g.test(file.name));&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;would work well. &lt;/p&gt;

&lt;p&gt;Well well. We have a CLI application. We can actually deploy this to npm. You can login to npm and run &lt;code&gt;npm deploy&lt;/code&gt; to get it up there. This has gone too long and I am not using going into deployment here. Adding the whole index.js below for your reference. Please let me know your thoughts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/usr/bin/env node

const fs = require('fs');
const chalk = require('chalk');

const { log } = console;
const { readdir } = fs;

const lsArgs = process.argv[2];

const fileDirectory = lsArgs ? lsArgs : process.cwd();

readdir(fileDirectory, { withFileTypes: true }, (err, files) =&amp;gt; {
    files = files.filter((item) =&amp;gt; !/(^|\/)\.[^\/\.]/g.test(item.name));
    if (err) {
        log(chalk.red('ERROR'));
                return;
    }
    files.forEach((file) =&amp;gt; {
        if (file.isDirectory()) {
            log(chalk.blueBright(file.name));
        } else {
            log(chalk.whiteBright(file.name));
        }
    });
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>node</category>
      <category>tutorial</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Tailwind CSS and Parcel</title>
      <dc:creator>vishnu prasad</dc:creator>
      <pubDate>Sat, 19 Jun 2021 17:16:30 +0000</pubDate>
      <link>https://dev.to/vishnup95/tailwind-css-and-parcel-g79</link>
      <guid>https://dev.to/vishnup95/tailwind-css-and-parcel-g79</guid>
      <description>&lt;p&gt;TLDR: A sample repo: &lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev.to%2Fassets%2Fgithub-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/vishnup95" rel="noopener noreferrer"&gt;
        vishnup95
      &lt;/a&gt; / &lt;a href="https://github.com/vishnup95/parcel-tailwind-example" rel="noopener noreferrer"&gt;
        parcel-tailwind-example
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      A repo demonstrating parcel and tailwind. 
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h2&gt;
  
  
  Tailwind CSS
&lt;/h2&gt;

&lt;p&gt;Tailwind CSS is a utility class CSS framework. It recieves a lot of hate and a lot of love from the frontend world.  If you are not familiar with Tailwind a quick introduction would be that it aims to help you develop UI component while staying in your HTML. It provides the developer with a list of classes that they can add to the HTML elements to style it as they wish. &lt;/p&gt;

&lt;p&gt;Tailwind is all about adding classes. Your HTML will end up with a lot of classes. If you don't like that I think you should look away. If it still interests you, like it does to me, I would interest in Tailwind CSS 2.1. The new version has added support for &lt;strong&gt;JIT(Just in Time)&lt;/strong&gt;. This just eases the pain of using Tailwind in development. See, Tailwind always had a problem of having a bad development experience for me. It was large and it was so chunky that browsers would sometimes would crash(&lt;strong&gt;sometimes&lt;/strong&gt;). JIT fixes a lot of that. It writes the CSS files according to your needs and classes added. Please read more &lt;a href="https://tailwindcss.com/docs/just-in-time-mode" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Parcel
&lt;/h2&gt;

&lt;p&gt;Parcel is web application bundler. You may be more familiar with tools like Webpack. Parcel is just faster and leaner. I would use Parcel for a smaller project.  Parcel is also working on a new v2 that is super exciting. JS compilation using Rust that is faster. Treeshaking CSS Modules. Lazy development builds. I thought I would give it a try with Tailwind CSS. Read more &lt;a href="https://v2.parceljs.org/" rel="noopener noreferrer"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  PostCSS
&lt;/h2&gt;

&lt;p&gt;PostCSS is a tool that transforms CSS using JS. Tailwind uses this under the hood. Setting up tailwind requires a little bit of see through to the PostCSS world and some plugins. Don't worry. It's not overwhelming. We will walk through the steps. Read more &lt;a href="https://github.com/postcss/postcss" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's start!
&lt;/h3&gt;

&lt;p&gt;Let's use Yarn as a package manager. Start with initializing a yarn project. Feel free to use npm and step through. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn init&lt;/code&gt; or if using npm &lt;code&gt;npm init -y&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Let's add the dependencies.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add -D tailwindcss@latest postcss parcel@next&lt;/code&gt; &lt;br&gt;
 or the equivalent &lt;/p&gt;

&lt;p&gt;Cool. That's a lot of it done. Let's start by definining a project structure. I placed all my files inside a &lt;code&gt;src&lt;/code&gt; folder. Feel free to follow along. &lt;/p&gt;

&lt;p&gt;Let's create a &lt;code&gt;index.html&lt;/code&gt; and &lt;code&gt;style.css&lt;/code&gt; in the src folder. Let's also create a folder called &lt;code&gt;assets&lt;/code&gt; and add a &lt;code&gt;tailwind&lt;/code&gt; folder. Leave it emplty for now.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3bstkygafgubelndeco.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fa3bstkygafgubelndeco.png" alt="Folder Structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Ignore tailwind.css for now&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Okay, now we need to work on the configs.Two configs we need to care about. PostCSS config &lt;code&gt;.postcssrc&lt;/code&gt; (Parcel recommends for caching) and &lt;code&gt;tailwind.config.js&lt;/code&gt;(Optional. Very nice to have in large projects)&lt;/p&gt;

&lt;p&gt;Create both files on the project root. Edit &lt;code&gt;tailwind.config.js&lt;/code&gt; as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  mode: "jit",
  purge: ["./src/index.html"],
  darkMode: false, // or 'media' or 'class'
  theme: {},
  variants: {},
  plugins: [],
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Small Explanation: mode: "jit" to enable the JIT Feature. Purge to remove unused CSS. Works using PurgeCSS. Leave the rest there for now. Do look into tailwind config in detail on the docs if you are interested. &lt;/p&gt;

&lt;p&gt;Now onto &lt;code&gt;.postcssrc&lt;/code&gt;. I would like to install a few PostCSS plugins first&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add -D cssnano autoprefixer@latest postcss-import&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;cssnano is to minify CSS. Autoprefixer for vendor prefix magic and postcss-import to import css files (Not truly needed. Just nice to be aware!)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//.postcssrc
{
  "plugins": {
    "postcss-import": {},
    "tailwindcss/nesting": {},
    "tailwindcss": {},
    "autoprefixer": {},
    "cssnano": {}
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;tailwindcss/nesting&lt;/code&gt; plugin helps us write nested scss in css files. Weird times we live in!&lt;/p&gt;

&lt;h3&gt;
  
  
  Okay, enough with the config. Let's write some styles.
&lt;/h3&gt;

&lt;p&gt;I understand you are impatient. We need two more things before it all stiches together. A script runner and a script&lt;/p&gt;

&lt;p&gt;&lt;code&gt;yarn add -D npm-run-all&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm-run-all&lt;/code&gt; helps to run multiple scripts in parellel, series, use glob like pattern matching and more. Read more &lt;a href="https://www.npmjs.com/package/npm-run-all" rel="noopener noreferrer"&gt;npm-run-all&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;Then in your &lt;code&gt;package.json&lt;/code&gt; you can add new scripts as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; "start": "npm-run-all --parallel 'watch:*'",

 "watch:start": "parcel serve src/index.html",
 "watch:css": "tailwindcss -i src/style.css -o src/assets/tailwind/tailwind.css -w"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That should be the setup done. Phew! BTW we are using &lt;code&gt;tailwindcli&lt;/code&gt; to watch for the changes and compile into a new file (tailwind.css).This is the CSS file you will need in the end. Make sure you link this as a stylesheet in your HTML.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;link rel="stylesheet href="PATH_TO_CSS"&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Go ahead and run &lt;code&gt;yarn start&lt;/code&gt; or &lt;code&gt;npm start&lt;/code&gt;. I would also add a couple of helpers to our &lt;code&gt;style.css&lt;/code&gt; at this point.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import "tailwindcss/base";
@import "tailwindcss/components";
@import "tailwindcss/utilities";

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can go ahead and start adding classes to your HTML now. Let us start by adding a text and seeing the changes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;p class="text-2xl font-bold text-center my-4"&amp;gt; Parcel and Tailwind says hello!&amp;lt;/p&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Play around with with the Tailwind CSS Docs. Look at the CSS file size.  If you are using vscode the ext &lt;code&gt;bradlc.vscode-tailwindcss&lt;/code&gt; is really useful. &lt;/p&gt;

&lt;p&gt;As an additional exercise you could add a build script and deploy your site to Netlify or gh-pages. &lt;/p&gt;

&lt;p&gt;Do let me know if you know if you are stuck somewhere. Suggestions are also always welcome. I am quite new to all this too!&lt;/p&gt;

&lt;p&gt;Hope you learned something new!&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>tutorial</category>
      <category>webdev</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
