Using ChatGPT, Github Copilot and Phind to generate Tailwind config for width classes

Using ChatGPT, Github Copilot and Phind to generate Tailwind config for width classes

Examining the results of ChatGPT 4, Github Copilot and Chat and Phind in generating Tailwind width configurations utilizing the golden ratio.

ยท

3 min read

In this article, I will show how I used ChatGPT, Github Copilot and Phind to generate a custom Tailwind config for width classes up to 800px for desktop resolution.

These language models can serve as helpful conversation partners, providing different solutions to the same problem.

Here, we'll compare their responses to a specific request involving the golden ratio and discuss their effectiveness.

Problem

As this was a personal project, I did not have a complete design, just some inspirational ideas that I wanted to try.

I wanted to add some custom width-sized in a Tailwind config for a web app up until about 800px for the desktop resolution.

I asked both Chat GPT 4 and Github Copilot Chat the same question and got different answers.

Chat GPT 4

Here is what I asked Chat GPT 4:

Here is what it suggested:

As you can notice it used the constraint that I added (to use the golden ratio) to calculate the actual size from the last one provided by me (384px) to reach the 800px that I asked for and then tried to create a series of width utilities matching a bit how Tailwind does it - by spacing them out.

Did not check all of the utilities proposed, but the first one and the last one are calculated ok from the rem to px ratio.

Github Copilot

I then tried to use Github Copilot via VSCode to generate this list.

Here is the prompt and the response:

It has some fine-grained steps, it reaches the 800 px and it correctly started from 400 (as Tailwind already defined 384px) but I don't see how it used the golden ratio (which is around 1.61).

It ignored the request to use the golden ratio: did not use it for spacing the utilities, nor used it for calculating the distance in rem or pixels between two utility classes.

Github Copilot Chat

I then tried Github Copilot Chat:

And it replied with the following:

It seems that it was not aware that Tailwind already has width classes up until 384px. But it did apply with an approximation of the golden ratio when spacing the width classes.

Phind

I asked Phind the same question and here is the answer:

I find the Phind answer better. It explains how it did the calculation, it used the golden ratio for each step and it also provides the Tailwind config and shows how to use it.


Enjoyed this article?

๐Ÿ‘‰ Join my Short Ruby News newsletter for weekly Ruby updates from the community and visit rubyandrails.info, a directory with learning content about Ruby.

๐Ÿ‘ Subscribe to my Ruby and Ruby on rails courses over email at learn.shortruby.com - effortless learning anytime, anywhere

๐Ÿค Let's connect on Ruby.social or Linkedin or Twitter where I post mainly about Ruby and Rails.

๐ŸŽฅ Follow me on my YouTube channel for short videos about Ruby

Did you find this article valuable?

Support Lucian Ghinda by becoming a sponsor. Any amount is appreciated!