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.
|
// 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:
|
// For a real-world example check here:
|
||||||
// https://github.com/wp-bond/bond/blob/master/src/Tooling/Vite.php
|
// 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
|
// 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" .
|
return "\n" .
|
||||||
jsTag($entry) .
|
jsTag($entry) .
|
||||||
"\n" .
|
"\n" .
|
||||||
|
@ -54,7 +54,6 @@ function isDev(string $entry): bool
|
||||||
curl_exec($handle);
|
curl_exec($handle);
|
||||||
$error = curl_errno($handle);
|
$error = curl_errno($handle);
|
||||||
curl_close($handle);
|
curl_close($handle);
|
||||||
|
|
||||||
return $exists = !$error;
|
return $exists = !$error;
|
||||||
} else {
|
} else {
|
||||||
return $exists = false;
|
return $exists = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue