• Stars
    star
    310
  • Rank 134,926 (Top 3 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 3 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Standalone Tailwind CSS CLI, installable via pip

Use Tailwind CSS without Node.js and install it via pip.

Why

Tailwind CSS is notoriously dependent on Node.js. If you're a Python developer, this dependency may not be welcome in your team, your Docker container, or your inner circle.

The Tailwind CSS team recently announced a new standalone CLI build that gives you the full power of Tailwind CLI in a self-contained executable β€” no Node.js or npm required.

However, installing such a standalone CLI isn't as easy as running npm install, the installation command for Node.js .

That's why I decided to make it as simple as running pip install command. As a result you can install the standalone * Tailwind CLI* via pip by running the following command:

pip install pytailwindcss

Now you can run tailwindcss in your terminal as:

tailwindcss -i input.css -o output.css --minify

Voila!

Get started

  1. Install tailwindcss via pip by executing the following command:

    pip install pytailwindcss
    
  2. [Optional] Preinstall tailwindcss binary by running the following command:

    tailwindcss_install
    

    If you skip this step, the binary will be downloaded on the first run of tailwindcss command.

  3. The tailwindcss command should now be available in your terminal. Try to run it:

    tailwindcss
    

    If the installation was successful, you should see the message about binary being downloaded on the first run. When download is complete, you should see the help output for the tailwindcss command. Use tailwindcss to create a new project or work with an existing Tailwind CSS project.

  4. Let's create a new project. Go to the directory where you want to host your Tailwind CSS project and initialize it by running:

    tailwindcss init
    

    This command will create the default tailwind.config.js file.

  5. Start a watcher by running:

    tailwindcss -i input.css -o output.css --watch
    
  6. Compile and minify your CSS for production by running:

    tailwindcss -i input.css -o output.css --minify
    

You got it. Please refer to official Tailwind documentation for more information on using Tailwind CSS and its CLI.

Caveats

It's not all roses, though. Giving up Node.js means you won't be able to install plugins or additional dependencies for your Tailwind CSS setup. At the same time, that might not be a dealbreaker. You can still customize Tailwind CSS via the tailwind.config.js file. And the standalone build also comes with all official Tailwind CSS plugins like @tailwindcss/aspect-ratio, @tailwindcss/forms, @tailwindcss/line-clamp, and @tailwindcss/typography. So in 90% of Tailwind CSS usage cases you should be covered, and the setup is so simplified now.

Here is what the Tailwind CSS team says about going the standalone Tailwind CSS route:

If you’re working on a project where you don’t otherwise need Node.js or npm, the standalone build can be a great choice. If Tailwind was the only reason you had a package.json file, this is probably going to feel like a nicer solution.

Bugs and suggestions

If you have found a bug, please use the issue tracker on GitHub.

https://github.com/timonweb/pytailwindcss/issues

2021 (c) Tim Kamanin - A Full Stack Django and Wagtail Developer

More Repositories

1

django-tailwind

Django + Tailwind CSS = πŸ’š
Python
1,430
star
2

django-bulma

Bulma theme for Django
CSS
339
star
3

django-clearcache

Clear Django cache from admin or command line
Python
48
star
4

Django-manage.py-anywhere

Run manage.py commands from anywhere. Finds the closest to current path manage.py file and runs commands against it.
Python
34
star
5

django-dbbackup-ui

Backup database and media files via Django admin interface (includes Wagtail admin support): pip install django-dbbackup-ui
Python
33
star
6

django-debug-permissions

Get a list of all user permissions available in the system
Python
29
star
7

wagtail-non-admin-draftail

Python
18
star
8

everyblock

Python
15
star
9

django-url-or-relative-url-field

A Django model field that supports both absolute and relative URLs.
Python
10
star
10

djow

Django On Wings (DJOW): Django Project Template
CSS
6
star
11

drupal-file-permissions

Drupal File Permissions Bash Script
Shell
5
star
12

wagtailsnippetscopy

'Copy A Snippet' Feature for Wagtail CMS
Python
5
star
13

django-forgiving-collectstatic

Python
5
star
14

django-ajax-comments-xtd

An addon app to https://github.com/danirus/django-comments-xtd that makes comments submittable via ajax
HTML
4
star
15

django-vue-helper

Python
4
star
16

Druppets

Druppets is a set of commonly used snippets of Drupal 6 Code
PHP
2
star
17

django-vue-starter

Plain simple Django project preconfigured for use with Vue. Not polished. For internal usage only.
Python
1
star
18

backup-jeans

Files and db backup script powered by Duplicity and PyInvoke
Python
1
star
19

docker-cron-swissknife

Alpine based dockerfile that allows to register and execute cron tasks with ease.
Shell
1
star
20

Simple-Moderation

Simple Moderation Module for Drupal
PHP
1
star
21

django-object-admin

Adds a nice floating menu with "Add/Change/Delete/History/Go to admin" links to a current page object.
CSS
1
star