How to quickly add Tailwind to an existing Jekyll site

February 23, 2023 5 mins TailwindCSS

he goal of this how to guide is to show you how to quickly include Tailwind CSS in your existing Jekyll site and build using the Tailwind CLI. All the code used in this demo can be found in our repository: jekyll-tailwindcss.

1. Prerequisites

  • Existing Jekyll site
  • Node.js installed

2. Install Tailwind CLI

Navigate to the root directory of your existing Jekyll site and running the below commands. These commands will install ‘tailwindcss’ as node module in your project as a dependency and initialise TailwindCSS.

npm install -D tailwindcss
npx tailwindcss init

After running the above commands you will notice a few differences with your directory, such as the inclusion of a node_modules directory and package.json files. The key file we will be focusing on however is the tailwind.config.js.

The contents of your tailwind.config.js file should be similar to the below:

/** @type {import('tailwindcss').Config} */
module.exports = {
    content: [],
    theme: {
        extend: {},
    },
    plugins: [],
}

At this point we now have TailwindCSS installed and initialised, however there is a little bit of configuring we will need to do in order to start using it in our mark up. We need to make Tailwind aware of the paths it needs to keep track of for the various classes we will be adding to our markup. For the purpose of this guide we need to keep track of files in _includes, _layouts and markdown files in our root directory.

/** @type {import('tailwindcss').Config} */
module.exports = {
    content: [ 
        '_includes/**/*.html',
        '_layouts/**/*.html',
        '*.markdown'
    ],
    theme: {
        extend: {},
    },
    plugins: [],
}

With the content array updated, Tailwind will be able to apply its styling to any .html file found in _includes, _layouts and similarly any .markdown file found on the root level of our project.

Lets now add the Tailwind directives to our main css file:

@tailwind base;
@tailwind components;
@tailwind utilities;

3. Adding Tailwind to our markup

The content I have in place for my basic site isn’t looking so great at the moment, there is no styling in place. Lets add a bit of styling to clean this up a bit.

In order to starting seeing the Tailwind classes take effect on your website you will need to run the below command.

npx tailwindcss -i ./assets/css/style.css -o ./assets/dist-style.css --watch

Note: if your CSS file is in another location you will need to update this command to reference it.

Lets start by adding a bit of styling to the header of demo site:

<header class="bg-slate-100">
    <div class="max-w-screen-lg mx-auto h-24 flex items-center">
        <a href="/">
            <h1 class="text-black text-3xl font-bold">Jekyll - TailwindCSS Demo</h1>
        </a>
    </div>
</header>

Once I refresh my browser I can immediately see the updates taking place.

We won’t cover Tailwind in detail in this post, if you are looking for more information on how to use Tailwind check out there official docs. After applying all the classes I need to clean up this page I end up with the below as my finished product:

If you would like to see all the code behind doing this you can clone the repository for this project: jekyll-tailwindcss.

All best on your journey with Tailwind & Jekyll!

5 preparation tips for AZ-900 Azure Fundamentals Exam

February 2, 2023 2 mins Microsoft Azure

Our approach to IT infrastructure and how we deliver software solutions has been changing over the years due to a wider adaptation of cloud computing. As a developer I needed to expand my understanding of cloud computing and how it affects my approach to design and delivery of solutions.

I am currently focused on learning Microsoft Azure, due to its usage within my organization . To date, I have earned two certifications; Microsoft Certified: Azure Fundamentals and Microsoft Certified: Azure Administrator Associate. I am currently preparing for another exam and realized that hearing someone’s experience has been really helpful in how I prepare. With that being said here are a few tips that could be useful when preparing for the AZ-900 Microsoft Azure Fundamentals:

  1. Study to understand the concepts – This exam is rather light; however, I found a lot of the questions asked will be scenario based. You will be tested on your ability to recall and apply the knowledge to a situation.
  2. Give yourself enough time to prepare – Don’t rush the preparation. Take your time to cover the material as this will act as the foundation for other associate level exams going forward.
  3. Sign up an Azure account – Microsoft offers a free trial that you can use to play around with their services. This will be really helpful in building familiarity with the services and the environment.
  4. Prepare according to the skills measured by Microsoft – There is a lot of content out there; ensure that you are first and foremost guided by the official Microsoft exam breakdown. If you are looking at learning resources for the exam separate from what is provided by Microsoft, ensure you can see the breakdown in the course material being provided by the third party.
  5. Complete a practice test – For me it was useful to have an idea of the sort of questions that are asked, as well as test myself before going into the exam. This allowed me to gauge how ready I was and could make the necessary adjustments. I found the MeasureUp practice tests to be really useful in that regard, especially with the feedback that explains why my answer was wrong. Note: This is not absolutely necessary.

All the best on your upcoming exam!