Skip to content

Latest commit

 

History

History
23 lines (17 loc) · 2.05 KB

File metadata and controls

23 lines (17 loc) · 2.05 KB
title Overview
description The internals of TailwindPHP — how the port mirrors TailwindCSS file-for-file, the compilation pipeline, caching, minification, and performance.
path advanced
order 140
section Advanced
meta_title Overview
meta_description The internals of TailwindPHP — how the port mirrors TailwindCSS file-for-file, the compilation pipeline, caching, minification, and performance.

Advanced

TailwindPHP is a 1:1 port of TailwindCSS 4.x to pure PHP. The guiding principle is fidelity: the codebase mirrors the original TypeScript project file-for-file — same file names, same organization — so that any behavior in TailwindCSS has an obvious home in PHP, and so that upstream changes can be tracked without guesswork.

Anything that is not part of the TailwindCSS port lives in one clearly marked place: src/_tailwindphp/. That directory holds the PHP-specific helpers — a reimplementation of the Rust lightningcss transforms (LightningCss.php), the CSS minifier (CssMinifier.php), and the companion library ports (lib/: clsx, tailwind-merge, CVA) under the TailwindPHP\Lib\* namespace. Everything else under src/ corresponds to a file in TailwindCSS.

Correctness is verified against Tailwind's own test suite. Test cases are extracted directly from TailwindCSS's .test.ts files and run against PHP output, so any drift from the original behavior fails immediately. The result is 4,074 passing tests covering utilities, variants, directives, plugins, and the companion libraries.

Pages

  • Architecture — the compilation pipeline (parse → scan → compile → optimize → minify), the source layout, the lightningcss equivalent, and the @port-deviation marker convention.
  • Caching & minification — the file-based cache (cache, cacheTtl, clearCache()) and what the CSS minifier does.
  • Performance & testing — PHP-specific optimizations, how parity with TailwindCSS is verified, and the code-quality gate.