=== CompileKit - Tailwind CSS Compiler ===
Contributors: mstrdh
Tags: theme, tailwind, css, cli, compiler
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 3.0.8
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Compile Tailwind CSS with a server-side compiler. Provides an admin UI, auto-compilation mode, and environment-aware output.

== Description ==
* Compiles Tailwind CSS v4 directly on the server.
* Choose a compiler: Standalone CLI binary or Node.js (npm) packages.
* Run compilation manually from the Admin UI or enable Auto-Compilation Mode for front-end refresh builds.
* Configure input and output CSS paths inside the active theme.
* Environment-aware output: Local is unminified with a source map, Staging is unminified, Live is minified.


== Installation ==
1. Upload the plugin folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins menu.
3. Go to "CompileKit" in the admin menu.
4. Install the Standalone CLI binary or Tailwind npm packages, set paths, and run the compiler.


== External services ==
This plugin can connect to GitHub to download the Tailwind Standalone CLI binary when requested in the admin UI.
An HTTPS request to GitHub is made only when an admin clicks “Download Tailwind Standalone CLI” or “Reinstall Tailwind Standalone CLI”. The request uses the user-agent “WordPress/compilekit”. Learn more about [privacy policy](https://docs.github.com/en/site-policy/privacy-policies/github-privacy-statement) and [terms of service](https://docs.github.com/en/site-policy/github-terms/github-terms-of-service).
If npm is available on the server, the plugin also runs npm, which connects to the npm registry (registry.npmjs.org) to resolve the Tailwind packages (tailwindcss, @tailwindcss/cli, @tailwindcss/forms, @tailwindcss/typography). This happens only when an admin clicks “Install Tailwind Node.js packages” or “Reinstall Tailwind Node.js packages”. Only the package names and npm’s standard request data are sent. Learn more about npm’s [privacy policy](https://docs.npmjs.com/policies/privacy) and [terms of use](https://docs.npmjs.com/policies/terms).


== Changelog ==

= 3.0.8 =
* CompileKit now requires the "install_plugins" capability instead of "manage_options", because it downloads executables and runs server processes. On sites with DISALLOW_FILE_MODS the CompileKit menu is hidden, and on multisite only super admins can use it.
* Activation no longer runs npm or writes package.json. "Delete Tailwind Node.js packages" again removes package.json together with node_modules and package-lock.json.
* "Reinstall Tailwind Node.js packages" now updates the packages to their latest versions instead of keeping the versions pinned by package-lock.json.
* "Reinstall Tailwind Standalone CLI" now keeps the working binary until the new one is downloaded and verified, so a failed download no longer leaves the site without a compiler.
* Auto-Compilation Mode now runs only on front-end page loads, so block editor requests (save, autosave) no longer wait for a compile.
* Auto-Compilation now uses one site-wide lock, so two admins refreshing at once no longer compile into the same file.
* The output CSS file can no longer be the input file or the theme's style.css, which the compile would overwrite.
* A path error no longer triggers the fallback compiler and is no longer shown twice.
* The settings page no longer fails when the theme contains an unreadable folder.
* A failed Standalone CLI download with HTTP 403 now shows the HTTP code instead of a misleading GitHub API rate limit message.
* Uninstall on multisite now removes the plugin data and files of every site.
* Fixed untranslated compiler labels, translator comments and an unescaped environment name on the settings page.
* Corrected the source map description: Local builds include a source map, Staging builds do not.

= 3.0.7 =
* On activation, the plugin now writes package.json with the Tailwind npm packages (without installing them), so code editors detect Tailwind right away. Requires npm on the server; without it, activation proceeds as before.
* "Delete Tailwind Node.js packages" now keeps package.json and removes only node_modules and package-lock.json, so the next install fetches the latest package versions.
* The npm package install now stops after 5 minutes with a clear message instead of hanging when the npm registry is unreachable.
* Multi-line compiler and npm output in admin notices is now shown line by line.
* Fixed the input and output CSS path placeholders: paths are relative to the active theme.
* Fixed the "Run on refresh" label not being linked to its checkbox.
* Documented the npm registry connection in the External services section.

= 3.0.6 =
* The compiler section header now shows the active compiler (e.g. "Local Compiler: Node.js"), and System Info marks the active compiler with an "Active" badge.
* Fixed the Standalone CLI version badge not showing: the version is now read from the CLI help header (Tailwind v4 has no --version flag) and also recorded by the compile pre-flight check if it was not recorded at download time.
* Tested up to WordPress 7.1.2.

= 3.0.5 =
* Tested up to WordPress 7.0.3.

= 3.0.4 =
* Fixed compilation being reported as failed on hosts that cap the number of processes/threads (ulimit -u), where the compiler finishes the build but never exits. The build is now completed as soon as the compiler reports it is done.
* Added a 20-second guard for compiler processes so a stuck build can no longer freeze the admin request until a gateway timeout.
* Removed the "Auto" compiler mode. Node.js (npm) is now the default; the other compiler is used automatically as a fallback when the selected one is missing or fails.
* Unminified builds (Local/Staging) now run the optimizer for a smaller stylesheet.
* Hardened the Node.js package installation: package lifecycle scripts are no longer executed, so a compromised dependency cannot run code on the server.

= 3.0.3 =
* Added a loading overlay with a status message for long-running actions (CLI download, npm install/remove, manual compile) so the page no longer appears frozen.

= 3.0.2 =
* Hardened output CSS path validation against parent-directory (..) traversal.
* More reliable npm detection during package install (now works on hosts with only shell_exec).
* Removed a redundant Node.js check that ran an extra process on every npm-based build.
* Cached the Standalone CLI pre-flight check to avoid an extra process on every build.
* Limited theme CSS scan depth for a faster scan and a cleaner file selector.
* Prevented a PHP warning when the output stylesheet has not been compiled yet.
* Improved Auto-Compilation locking to prevent overlapping builds on slow hosts.

= 3.0.1 =
* Confirmed compatibility with WordPress 7.0.

= 3.0.0 =
* New admin UI (redesigned settings and workflow)
* Added compiler selection: Auto, Standalone CLI, or Node.js (npm)
* Environment-aware builds [Local/Staging is unminified, optional source maps || Live is minified]
* Improved diagnostics and admin notices for compiler failures
* Improved compiler workflow and overall stability
* Refactored architecture for reliability and maintainability

= 2.2.0 =
* Minor updates

= 2.1.9 =
* Added an option to change worker threads count

= 2.1.8 =
* General Improvements

= 2.1.7 =
* Added "Update Available" notice on checker screen
* Enhanced error display for failed compilations.

= 2.1.6 =
* Added multiple fallback options to detect installed Tailwind Compiler version

= 2.1.5 =
* Added @tailwindcss/typography and removed tailwind-clamp from the list of npm modules

= 2.1.4 =
* General code updates and improvements.

= 2.1.3 =
* General code updates and improvements.
* Added fallback method to compile CSS via npx if binary fails.

= 2.1.2 =
* General code updates.
* Updated LICENSE.
* Tailwind CLI binary is now deleted during plugin uninstall.

= 2.1.1 =
* New updates to compile with WordPress requirements.

= 2.1.0 =
* Added Updates page.
* Added an option to check the current and latest CLI version.
* Added an option to reinstall the latest CLI version.

= 2.0.0 =
* Initial public release.
