On creating a WordPress theme generator optimized for Tailwind

I forked the underscores.me theme generator a long time ago.

I submitted a pull request in 2018, later realized someone else had submitted a fix for the same bug in 2017, and then started using a local, patched version of underscores.me whenever I started a new project.

Once I had a local version of the generator, I started making other changes: I fixed more bugs as I encountered them, added a new field for function prefixes and started stripping out files I never used.

Then I realized I was moving a lot of files around to match my preferred directory structure every time I started a project, so I updated the generator to move those files around while creating the theme archive.

After changing the generated theme’s directory structure, I realized I needed to write a new script so npm run bundle would still work, and I did that, too, and had the generator add it to the archive.

But the biggest changes happened after I started using Tailwind. (I wrote another post last week about how that went.) I didn’t need Sass anymore. Or CSS. Or class attributes in my HTML. So I made the generator get rid of all of those, too, before adding the tools I’d need to use Tailwind productively.

I decided to call my new generator _tw and to make it public.

In mid-2017, Automattic was “excited and reinvigorated about Underscores and its role in the future of theming,” but a lot has changed since then, and it appeared the project was dead at the beginning of 2020.

Then a new committer was added, there was a burst of activity, and I added Tailwind to my fork of the generator.

I considered forking _s itself rather than forking the generator, but when I made the last round of major changes to my fork of the generator, commits were still hitting _s fairly regularly. Maintaining a generator that transforms the canonical _s allowed me to integrate those changes just by dropping _s into the generator’s prototype folder.

Is _s the right choice for a lightweight starter theme as we approach the era of full-site editing? I think it still could be. Does it make for a familiar starting point for someone looking to experiment with Tailwind inside of a WordPress theme for the first time? I’m very confident it does.

If any of that sounds interesting to you, please give _tw a try. I’d love to hear your feedback.

3 comments on “On creating a WordPress theme generator optimized for Tailwind”

  1. Thanks Greg! Delighted to find this. I’m starting out with theme dev and was searching for a Tailwind starting point and voila! I’ll let you know how i get on!

Leave a Reply

Your email address will not be published. Required fields are marked *