diff --git a/inc/vite.php b/inc/vite.php index afea007..98ae716 100644 --- a/inc/vite.php +++ b/inc/vite.php @@ -4,7 +4,7 @@ if (!defined("_ECRIRE_INC_VERSION")) { } // Helpers here serve as example. Change to suit your needs. -const VITE_HOST = "https://localhost:5134"; +// const VITE_HOST = "https://localhost:5134"; // For a real-world example check here: // https://github.com/wp-bond/bond/blob/master/src/Tooling/Vite.php @@ -15,8 +15,8 @@ const VITE_HOST = "https://localhost:5134"; // Prints all the html entries needed for Vite -function vite(string $entry): string -{ +function vite(string $entry, $port = "5134"): string { + defined('VITE_HOST') || define('VITE_HOST', "https://localhost:".$port); return "\n" . jsTag($entry) . "\n" . @@ -54,7 +54,6 @@ function isDev(string $entry): bool curl_exec($handle); $error = curl_errno($handle); curl_close($handle); - return $exists = !$error; } else { return $exists = false;