<?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: F.J.</title>
    <description>The latest articles on DEV Community by F.J. (@fjkhan).</description>
    <link>https://dev.to/fjkhan</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%2F372514%2F06769931-33aa-4e7f-a99b-00b7c90c5a82.png</url>
      <title>DEV Community: F.J.</title>
      <link>https://dev.to/fjkhan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fjkhan"/>
    <language>en</language>
    <item>
      <title>On Queerness, Emancipendence and Belonging</title>
      <dc:creator>F.J.</dc:creator>
      <pubDate>Sat, 08 Aug 2020 03:46:21 +0000</pubDate>
      <link>https://dev.to/fjkhan/on-queerness-emancipendence-and-belonging-3bfk</link>
      <guid>https://dev.to/fjkhan/on-queerness-emancipendence-and-belonging-3bfk</guid>
      <description>&lt;p&gt;The first week of August holds tremendous significance for Jamaicans. We celebrate our ancestors' emancipation from slavery (Aug 1) and gaining independence as a nation from the colonizers (Aug 6). Since 2015, the LGBTQ+ community has also been hosting pride celebrations during this eventful week.&lt;/p&gt;

&lt;p&gt;Our motto, "Out of Many, One People", is reflective of a culture rich with contributions from people of many nations and creeds. As is the case with most things that are easier to say than do, I fear our practice of celebrating diversity has yet to align with our theoretical celebration of it.&lt;/p&gt;

&lt;p&gt;I am not saying I expect us to be perfect. I am simply acknowledging that we have much work to do as a people before all of us can truly feel at home in a country we love so dearly.&lt;/p&gt;

&lt;p&gt;As a queer man in Jamaica who works in tech, I tend to be given a front-row seat to the sexism, anti-queerness and toxic masculinity for which tech spaces have gotten a bad reputation. I am yet to work at an organization where I truly feel comfortable. Notwithstanding, I have been fortunate to encounter some amazing coworkers. &lt;/p&gt;

&lt;p&gt;Still, I feel lonely in Jamaica's tech scene as an openly queer man. I can imagine other LGBTQ+ people feel similarly but given our context, stepping outside of the proverbial closet can have adverse effects on our job security. &lt;/p&gt;

&lt;p&gt;Queer spaces for people in tech aren't novel. There are several communities and non-profits engaged in this work such as OutInTech, TransTech Social, WomenWhoCode, LesbiansWhoTech, and QueerJS just to name a few. These are all wonderful communities and I've had good experiences engaging with them. &lt;/p&gt;

&lt;p&gt;While I can relate generally to the discrimination and other challenges we face as queer people in the global tech industry, a shared cultural context has been notably absent from these communities. &lt;/p&gt;

&lt;p&gt;To this end, my friend Sam and I created a Discord server called "Qodescope" for LGBTQ+ Jamaicans in tech. Qodescope is intended to be a safe space for us to connect, share ideas, grow and learn from each other. And what better time to launch it than during Emancipendence and Pride week!?&lt;/p&gt;

&lt;p&gt;So if you're LGBTQ+, currently working in the tech industry or intend to, and would like to connect, please reach out to us and we'll send you an invitation to join our server! We're looking forward to meeting you!&lt;/p&gt;

</description>
      <category>pride</category>
      <category>community</category>
      <category>lgbtq</category>
    </item>
    <item>
      <title>Developing WordPress Themes With TailwindCSS – Part I</title>
      <dc:creator>F.J.</dc:creator>
      <pubDate>Mon, 29 Jun 2020 20:33:27 +0000</pubDate>
      <link>https://dev.to/fjkhan/developing-wordpress-themes-with-tailwindcss-and-gulp-part-i-4moc</link>
      <guid>https://dev.to/fjkhan/developing-wordpress-themes-with-tailwindcss-and-gulp-part-i-4moc</guid>
      <description>&lt;p&gt;In this series, I'll be walking through the process of setting up a local environment for WordPress theme development using TailwindCSS. &lt;/p&gt;

&lt;p&gt;Whether you're on Linux, Windows or Mac, we'll need to run our WordPress own server. You can use XAMPP, WampServer, MAMP or similar software that enables you to run a local PHP server with Apache and MySQL. I'll be using MAMP but feel free to download and install your preferred tool. &lt;/p&gt;

&lt;p&gt;To install MAMP, navigate to &lt;a href="https://www.mamp.info/en/downloads/"&gt;https://www.mamp.info/en/downloads/&lt;/a&gt; and download the package file; double-click the downloaded package to begin the installation. Once our server is installed, we can start it by opening MAMP and clicking 'Start servers'. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m-Z9Qevi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dcwzoi5vnaljj33h8zxp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m-Z9Qevi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dcwzoi5vnaljj33h8zxp.png" alt="MAMP launch screen" width="880" height="484"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Optionally, we can configure the ports and document root or opt to keep the defaults. These options are reachable via &lt;code&gt;MAMP &amp;gt; Preferences&lt;/code&gt;. I kept the default ports and configured a different document root to a project folder I had previously created. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kcg_SgiQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fey6z75ccor6wlywhh3d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kcg_SgiQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fey6z75ccor6wlywhh3d.png" alt="MAMP Port Configuration" width="880" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OwcRZnyb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kyishlg12sfdpd8mxzmy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OwcRZnyb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kyishlg12sfdpd8mxzmy.png" alt="MAMP Web Server Configuration" width="880" height="529"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we'll get the latest version of &lt;a href="https://en-gb.wordpress.org/download/"&gt;WordPress&lt;/a&gt; and unpack the downloaded zip file into your document root. You can rename the extracted folder to the name of your project to keep track of your websites. &lt;/p&gt;

&lt;p&gt;Now that we've got our WordPress site in place, we can create the database to store our site data. Navigate to &lt;code&gt;http://localhost:8888/phpMyAdmin&lt;/code&gt; and create your new database. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--o-oKpUYI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1mq3x8vyck72rg5zgfbu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--o-oKpUYI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1mq3x8vyck72rg5zgfbu.png" alt="php myAdmin" width="832" height="362"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we'll point our WordPress site to our newly created database. Open your site folder (the one you extracted WordPress to) and locate the file &lt;code&gt;wp-config-sample.php&lt;/code&gt;. We're going to rename this file to &lt;code&gt;wp-config.php&lt;/code&gt; and update it the following options:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;DB_NAME &amp;lt;database name&amp;gt;
DB_USER root
DB_PASSWORD root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Great! Now we're all set! If you navigate to &lt;code&gt;localhost:8888/&amp;lt;site-name&amp;gt;&lt;/code&gt; you should see the WordPress installation screen. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--czdwkS7n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q3ecplijicmt6sq7uju0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--czdwkS7n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/q3ecplijicmt6sq7uju0.png" alt="WordPress Installation Screen" width="614" height="689"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you fill out the form, you can log in and start using your brand new local WordPress site!&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Cover image by &lt;a href="https://unsplash.com/@igormiske?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Igor Miske&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>wordpress</category>
      <category>tutorial</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Getting Started with the MongoDB Extension for VS Code</title>
      <dc:creator>F.J.</dc:creator>
      <pubDate>Tue, 19 May 2020 20:18:19 +0000</pubDate>
      <link>https://dev.to/fjkhan/getting-started-with-the-mongodb-extension-for-vs-code-2fab</link>
      <guid>https://dev.to/fjkhan/getting-started-with-the-mongodb-extension-for-vs-code-2fab</guid>
      <description>&lt;p&gt;Last week MongoDB &lt;a href="https://www.mongodb.com/blog/post/introducing-mongodb-for-vs-code"&gt;announced&lt;/a&gt; the release of their extension "MongoDB for VS Code". Naturally, I was very excited to read the news given my love for VS Code and all things MongoDB.&lt;/p&gt;

&lt;p&gt;The new MongoDB extension allow us to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Connect to a MongoDB or Atlas cluster, navigate through your databases and collections, get a quick overview of your schema, and see the documents in your collections&lt;/p&gt;

&lt;p&gt;Create MongoDB Playgrounds, the fastest way to prototype CRUD operations and MongoDB commands&lt;/p&gt;

&lt;p&gt;Quickly access the MongoDB Shell, to launch the MongoDB Shell from the command palette and quickly connect to the active cluster.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;em&gt;Source:&lt;/em&gt; &lt;a href="https://www.mongodb.com/blog/post/introducing-mongodb-for-vs-code"&gt;MongoDB&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To get started, install the extension via the &lt;a href="https://marketplace.visualstudio.com/items?itemName=mongodb.mongodb-vscode"&gt;VS Code Marketplace&lt;/a&gt;. We can also install it by opening Extensions tab in VS Code (&lt;code&gt;CMD + Shift +X&lt;/code&gt; on Mac or &lt;code&gt;Ctrl + Shift + X&lt;/code&gt; on Windows) and searching for "MongoDB".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RRwhYtk2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fkx95b382h2vxd5a772e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RRwhYtk2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fkx95b382h2vxd5a772e.png" alt="MongoDB Extension for VS Code"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once installed there will be a new MongoDB tab that we can use to add our connections by clicking "Add Connection". If you've used MongoDB Compass before, then the form should be familiar. You can enter your connection details in the form, or use a connection string. I went with the latter as my database is hosted on MongoDB Atlas.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gLVO1hz2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/au3jorcduif6gnmo0twh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gLVO1hz2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/au3jorcduif6gnmo0twh.png" alt="Add new MongoDB connection"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--IoXM5efq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bvy6m916x2skn4u5pdau.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--IoXM5efq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bvy6m916x2skn4u5pdau.png" alt="Connect to MongoDB"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To obtain your connection string, navigate to your "Clusters" page and select "Connect". &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PpSDURPO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sinjed041v0mtcacn3xi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PpSDURPO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sinjed041v0mtcacn3xi.png" alt="Connect to MongoDB Cluster"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose the "Connect using MongoDB Compass" option and copy the connection string. Make sure to add your username and password in their respective places before entering the string in VS Code. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MeYwGTlf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2m2r6vrelhq4ecvjzvcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MeYwGTlf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2m2r6vrelhq4ecvjzvcx.png" alt="Connection Method"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---1kghcPc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0y4l03b33h2zly6s3zil.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---1kghcPc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/0y4l03b33h2zly6s3zil.png" alt="Copy Connection String"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yh6cYA3K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/she7n3enrn9w6chqbrma.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yh6cYA3K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/she7n3enrn9w6chqbrma.png" alt="Enter connection string"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you've connected successfully, you should see an alert. At this point, you can explore the data in your cluster, as well as your schemas.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--MUZwhji6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8s7eo2acjbbee839viqz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MUZwhji6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/8s7eo2acjbbee839viqz.png" alt="Connected Successfully"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can now create a new playground by using the menu on the MongoDB tab and selecting the "Create MongoDB Playground option".&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bnhFWl8v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ik8d4wghmplkcbcbcq05.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bnhFWl8v--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ik8d4wghmplkcbcbcq05.png" alt="Create MongoDB Playground"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The playground opens a template you can use or modify. Here I've written a few commands to add data to my test database and a simple &lt;em&gt;find&lt;/em&gt; query. The playground is the perfect place to test your queries and aggregation pipelines. The results are shown in the Output window.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EJuEYXSq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bb36bb0f832nwsxzb2s9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EJuEYXSq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/bb36bb0f832nwsxzb2s9.png" alt="Playground Example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it! Congratulations, you have now created your first successful connection to your MongoDB database using the new extension! Happy hacking!&lt;/p&gt;

</description>
      <category>vscode</category>
      <category>mongodb</category>
      <category>nosql</category>
    </item>
    <item>
      <title>What is Tailwind CSS?</title>
      <dc:creator>F.J.</dc:creator>
      <pubDate>Tue, 05 May 2020 01:05:22 +0000</pubDate>
      <link>https://dev.to/fjkhan/what-is-tailwind-css-3153</link>
      <guid>https://dev.to/fjkhan/what-is-tailwind-css-3153</guid>
      <description>&lt;p&gt;I started using Tailwind a few months ago and it has dramatically improved my workflow. So much so that I decided to write a gentle introduction attempting to demystify Tailwind's "utility-first" ideology.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Tailwind CSS?
&lt;/h2&gt;

&lt;p&gt;Tailwind is a "utility-first" CSS framework that lends itself to rapid custom design prototyping. According to their website, Tailwind is a &lt;em&gt;"highly customizable, low-level CSS framework that gives you all of the building blocks you need to build bespoke designs without any annoying opinionated styles you have to fight to override."&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What does "utility-first" mean?
&lt;/h2&gt;

&lt;p&gt;I was initially confused about what made Tailwind distinct from other CSS frameworks I had tried; for example, Bootstrap, Foundation, Material UI etc. But after experimenting with it on a project, I understood. &lt;/p&gt;

&lt;p&gt;Other CSS frameworks ship with default themes and default-styled components which you have to painstakingly customize. These customizations require a lot of sleuthing to find every occurrence of that class and then modifying it &lt;em&gt;for every screen size&lt;/em&gt;. At this point, you're probably using &lt;code&gt;!important&lt;/code&gt; a LOT.&lt;/p&gt;

&lt;p&gt;Instead, Tailwind provides you with a set of aptly-named classes. These classes are the "utilities" you use to style your elements; giving you complete control over their appearance and enabling you to create a "theme" if you wish. The result of this? You have to build everything from &lt;em&gt;scratch&lt;/em&gt;. Depending on how you perceive it, it's either a glass half-empty or half-full situation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Trivial scenario:
&lt;/h3&gt;

&lt;p&gt;I'm building a page and I need a button. This button should have a small border-radius, white text, blue background, and a darker blue background on hover.&lt;br&gt;
I could do something like this: &lt;/p&gt;

&lt;p&gt;html&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;button class="button"&amp;gt; Click me!&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;CSS&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.button {
  background: #4299e1;
  padding: 0.5rem 1rem;
  border-radius:0.25rem;
  color:#ffffff;
}

.button:hover {
  background: #2b6cb0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fi%2Fiyu9joeodw34eodeddd8.gif" 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%2Fi%2Fiyu9joeodw34eodeddd8.gif" alt="Button example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If I needed several buttons with the same metrics (spacing, padding, margin etc) but different colors, we can easily see how the CSS could balloon exponentially. &lt;/p&gt;

&lt;p&gt;eg. I now need to add a green button, so I refactor the base class and add 4 additional classes to account for differences in colour and hover effects:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.button {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius:0.25rem;
  color:#ffffff;
}

.button.blue {
  background: #4299e1;
}

.button.blue:hover {
  background: #2b6cb0;
}

.button.green {
  background: #48bb78;
}

.button.green:hover {
  background: #2f855a;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But I only need this green button in one place....&lt;/p&gt;

&lt;h2&gt;
  
  
  Tailwind to the rescue
&lt;/h2&gt;

&lt;p&gt;Tailwind provides us with an easier way out of this predicament. Using the framework's utility classes, the original html becomes:&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;button class="rounded py-2 px-4 text-white bg-blue-500 hover:bg-blue-700"&amp;gt; 
Click me!
&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fi%2Ffad1jqxb2np7x3lrxl3h.gif" 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%2Fi%2Ffad1jqxb2np7x3lrxl3h.gif" alt="Tailwind button example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And if I need a green button?&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;button class="rounded py-2 px-4 text-white bg-green-500 hover:bg-green-700"&amp;gt; 
Click me!
&amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&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%2Fi%2Fjrvx4nl8toq7uf37ll7c.gif" 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%2Fi%2Fjrvx4nl8toq7uf37ll7c.gif" alt="Green button example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I have the single instance of the green button I need, without adding additional code to the CSS file. If I wanted to extract the component classes to make them reusable, it would look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.button {
    @apply py-2 px-4 rounded text-white;
 }
.button.blue {
    @apply bg-blue-500
 }
.button.blue:hover {
    @apply bg-blue-700;
 }
.button.green {
    @apply bg-green-500;
 }
.button.green:hover {
    @apply bg-green-700;
 } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is much simpler to read and write than pure CSS, or playing whack-a-classname.&lt;/p&gt;

&lt;p&gt;Using this approach makes it easier to build custom components and share styles. Sharing colours across elements is also easier, and doesn't require sifting through a massive CSS file to locate the HEX (or RGB) code. Also, in the event that we customize the color palette all the changes will cascade seamlessly. And the CSS...well, I don't need to spend time defining every single thing as all the utilities are already defined in the framework. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Tailwind facilitates full customization; inclusive of colours, spacing (used to determine margins and padding), and font sizing.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;So let's break down the Tailwind utilities I've used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;rounded:&lt;/strong&gt; Applies a default (0.25rem) border-radius to the element. Variations include rounded-sm, rounded-md, rounded-lg and rounded-full.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;bg-blue-500:&lt;/strong&gt; Specifies the colour and weight of the background. The number specifies the weight of the colour. In this case, 500. Using bg-blue-300 would result in a lighter shade of blue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;hover:bg-blue-700:&lt;/strong&gt; Adds hover style; specifying a heavier weight of the same hue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;py-2, px-4:&lt;/strong&gt; Applies vertical (y) and horizontal (x) padding in increments, respectively (0.5rem &amp;amp; 1rem). p-1 equates to a padding of 0.25rem.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;text-white:&lt;/strong&gt; Specifies text colour. Text, border, and background colours are all generated in the same way. For eg. if we wanted a text colour that was the same colour as the button we could use text-blue-500.&lt;/p&gt;

&lt;p&gt;To see the examples in action, check out the codepen &lt;a href="https://codepen.io/FJKhan/pen/eYpvPGr" rel="noopener noreferrer"&gt;here&lt;/a&gt; . For more information on Tailwind, take a look at their &lt;a href="https://tailwindcss.com/docs/" rel="noopener noreferrer"&gt;documentation&lt;/a&gt;. It is very thorough and includes examples for each utility class, as well as how to customize them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of Using Tailwind CSS
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Mobile-first &amp;amp; responsive
&lt;/h3&gt;

&lt;p&gt;Tailwind uses a mobile-first breakpoint system that you're probably already familiar with (sm, md, lg, xl). Defining how elements should behave at various breakpoints is a breeze using these prefixes. eg. Changing the flex direction of a container from &lt;code&gt;column&lt;/code&gt; on mobile, to &lt;code&gt;row&lt;/code&gt; on larger screens: &lt;code&gt;&amp;lt;div class="flex flex-col sm:flex-row"&amp;gt; ... &amp;lt;/div&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  No more whacky class names.
&lt;/h3&gt;

&lt;p&gt;(Almost) All the css rules you need to style an element can be achieved by using one, or a combination of several Tailwind utilities. Classnames made easy. No distress necessary.&lt;/p&gt;

&lt;h3&gt;
  
  
  Smaller css files
&lt;/h3&gt;

&lt;p&gt;Since (almost) all the classes you need are already predefined, you rarely have to write custom css which reduces bloating and results in...smaller css files. Combine Tailwind with PurgeCss to strip out classes you never use to result in &lt;em&gt;really&lt;/em&gt; tiny minimized css files.&lt;/p&gt;

&lt;h3&gt;
  
  
  Less anxiety
&lt;/h3&gt;

&lt;p&gt;Collaborate with other developers without worrying about introducing breaking changes. Tailwind provides a common language through shared classnames. Classes in your HTML is local and so are changes, so you can modify styles without worrying about other elements breaking.&lt;/p&gt;

&lt;h2&gt;
  
  
  In the end...
&lt;/h2&gt;

&lt;p&gt;... Tailwind saves me from writing hundreds of lines of css with increasingly ridiculous classnames in order to style elements and provides a common language for developers across the project. No more bloat from ad-hoc classnames because the developer couldn't find a particular style to modify. Everyone is utilizing a set of pre-defined utility classes. My favorite part? Not having to hunt for, and manually override framework classes.&lt;/p&gt;

&lt;p&gt;I understand how ridiculous it might look at first glance. I was very skeptical of all the "inline" styles at first; but give it a try. I highly recommend it over other frameworks for projects that require a greater degree of control over the UI or have custom designs. It will save you hundreds of lines of CSS and lots of headaches; literally.&lt;/p&gt;

&lt;p&gt;Share your experience using Tailwind CSS in the comments!&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>tailwindcss</category>
    </item>
  </channel>
</rss>
