Tailwind CSS Compiler API
Kirim markup HTML, dapatkan CSS Tailwind v4 yang sudah dikompilasi berdasarkan class yang benar-benar dipakai.
Endpoint
POST /api/compile
Content-Type: application/json
{
"html": "<div class=\"bg-red-500 text-white p-4\">Test</div>",
"css": "@theme { --color-brand: oklch(0.7 0.15 200); }"
}
Contoh
curl -X POST https://tw-dun.vercel.app/api/compile \
-H "Content-Type: application/json" \
-d '{"html": "<div class=\"bg-red-500 text-white p-4\">Test</div>"}'
Respons
{
"success": true,
"css": "/*! tailwindcss v4 | MIT License */ ...",
"durationMs": 41,
"bytes": 4880
}
Opsi lain
GET /api/compile?html=...&format=css— hasil mentah sebagaitext/csssources: ["..."]— kompilasi dari beberapa file sekaliguscss: "@theme { ... }"— tambahkan token tema / custom utility sendiri