From 2ab2b9caa606ececee8907b60d1445cdc2f61544 Mon Sep 17 00:00:00 2001 From: tofulm Date: Wed, 17 Jan 2024 16:46:03 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20on=20ajoute=20la=20possibilit=C3=A9=20d?= =?UTF-8?q?e=20charger=20avec=20un=20port=20different,=20pratique=20si=20o?= =?UTF-8?q?n=20a=20plusieurs=20plugins=20qui=20utilisent=20plusieurs=20ins?= =?UTF-8?q?tance=20de=20vite?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/vite.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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;