PythonPython

You can now use 'pip' to install Tailwind CSS. Node.js is no longer required!

Dec 27, 2021 · by Tim Kamanin

I recently released pytailwindcss, a Python package that lets you install the Tailwind CSS executable via pip with just one command:

pip install pytailwindcss

After the installation is complete, use the terminal to run the tailwindcss command:

tailwindcss

Behind the scenes, it runs a standalone Tailwind CSS build that doesn’t require Node.js to be installed on your system! Yes, you read that right, no more fiddling with Node and its quirks.

You simply install Tailwind CSS via pip and use the tailwindcss command to:

# Initialize and create a tailwind.config.js file
./tailwindcss init

# Start a watcher
./tailwindcss -i input.css -o output.css --watch

# Compile and minify your CSS for production
./tailwindcss -i input.css -o output.css --minify

The pytailwindcss package can be used with any Python framework, including Django and Flask. Essentially, it gives you quick access to the heart of Tailwind CSS - the tailwindcss command. The rest is up to you. This package is pretty minimal.

This package is the first and most important step toward making Django-Tailwind (a package that integrates Django and Tailwind CSS) entirely Python based, rather than relying on Node.js. The next step is to figure out how to make page and style reloading work without Node.js. I assume that shouldn’t be difficult. So if you’re a Django developer and use Tailwind CSS, stay tuned for upcoming announcements.

In the meantime, check out the pytailwindcss repo and get ready for the upcoming 2022. Have a happy one!

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓