DEV Community

Nwanguma Victor
Nwanguma Victor

Posted on • Updated on

Tailwind CSS Standalone CLI: Use Tailwind CSS without Node.js

Tailwind just released a standalone CLI in a self-contained executable, no Node.js or npm required.


Get started

Download the executable for your platform from the latest release.

Copy it to the root directory of your project.

Rename the executable to "tailwindcss".

Create anywhere in your project an entry point input.css and output.css destination for the compiled css. Also note the path of both files relative to the "tailwindcss" executable

Now you can use it just like the npm-distributed CLI tool:

# Open a terminal at project root

# Create a tailwind.config.js file
./tailwindcss init

# Start a watcher
./tailwindcss -i <relative-path-to-input.css> -o <relative-path-to-output.css> --watch

# Compile and minify your CSS for production
./tailwindcss -i <relative-path-to-input.css> -o <relative-path-to-output.css> --minify
Enter fullscreen mode Exit fullscreen mode

It comes bundled with the latest versions of all of tailwind's first-party plugins, so if you want to use them in your project, just require them in your tailwind.config.js file like you would in a Node-based project:

module.exports = {
  // ...
  plugins: [
    require('@tailwindcss/forms'),
    require('@tailwindcss/typography'),
  ]
}
Enter fullscreen mode Exit fullscreen mode

Refrences

Standalone CLI: Use Tailwind CSS without Node.js - Adam Wathan

Top comments (2)

Collapse
 
anatugreen profile image
Anaturuchi

Thanks bro. Here is my little observation though:
This would be more helpful if you specified how to go about the "input.css" and "output.css". Because if you simply do: "./tailwindcss -i input.css -o output.css --watch", you will get the message "input file input.css does not exist.".
This article is same as what the official article on standalone tailwind css did.
I believe documentations should be written with absolute beginners in mind.

Collapse
 
kachidk profile image
Nwanguma Victor • Edited

Thank you for your observation, I will see to it and make changes