Lesson 4 +10 XP

CLI, PostCSS, and Play CDN

Vite is one option - but you can also use the Tailwind CLI, PostCSS, or the Play CDN for quick prototyping.

Tailwind CLI

The CLI is a standalone build tool with no framework required:

Code

bash
npm install tailwindcss @tailwindcss/cli

Create your input CSS with @import "tailwindcss";, then build:

Code

bash
npx @tailwindcss/cli -i ./src/input.css -o ./src/output.css - watch

Link the compiled CSS in your HTML:

Code

html
<link href="./output.css" rel="stylesheet">

A standalone executable (no Node.js needed) is also available from GitHub releases.

PostCSS

Recommended for frameworks like Next.js and Angular:

Code

bash
npm install tailwindcss @tailwindcss/postcss postcss

Add it to postcss.config.mjs:

Code

js
export default {
  plugins: {
    "@tailwindcss/postcss": {}
  }
};

Then @import &quot;tailwindcss&quot;; in your CSS and run your build.

Play CDN (prototyping only)

For quick experiments with no build step, add a single script tag:

Code

html
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>

You can even use &lt;style type=&quot;text/tailwindcss&quot;&gt; blocks with full Tailwind features:

Code

html
<style type="text/tailwindcss">
  @theme { - color-clifford: #da373d;
  }
</style>

Warning: the Play CDN runs an in-browser compiler - use it for development only, not for production.

TL;DR

  • CLI: npx @tailwindcss/cli -i input.css -o output.css - watch.
  • PostCSS: add @tailwindcss/postcss to postcss.config.
  • Play CDN: one script tag, dev-only.