feat: on ajoute la possibilité de charger avec un port different, pratique si on a plusieurs plugins qui utilisent plusieurs instance de vite
This commit is contained in:
parent
7096c79b64
commit
2ab2b9caa6
1 changed files with 3 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue