Jay Miller

Switching from TailwindCSS to PyTailwindCSS

Sep 07, 2022 10:34 AM

I often use TailwindCSS for my web project and this often means that wind up with a package.json and lock-file just for tailwind.

Jon Banafato, my Cohost on Python Community News showed me pytailwindcss.

This will be a short post as pytailwindcss is the standalone tailwind CLI but available through pip.

Installing and Running PyTailwindCSS

pytailwindcss makes tailwind pip-able.

pip install pytailwindcss

To run pytailwindcss you send the commands as you would had it been installed with NPM.

tailwindcss -c tailwindcss.config.js -o tailwind.css --minify

You lose access to custom plugins but you still have the ability to use the built in plugins and you can customize your settings with in your config file.

But if you're not doing much more than the custom framework, feel free to remove those node_modules, package.json and package-lock.json files.