Skip to content

Commit

Permalink
build: Vite check environment variable.
Browse files Browse the repository at this point in the history
  • Loading branch information
danimalweb committed Nov 27, 2023
1 parent e8289df commit 03e146f
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions inc/lib/vite.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
class Vite
{
public static $serverUrl = 'http://localhost:3000';
// public static $serverUrl = 'https://tofino.loca.lt';

public static function getBrowserSyncUrl($port = 3001)
{
Expand All @@ -28,17 +27,11 @@ public static function isBrowserSyncRunning() {

public static function isDevServerRunning()
{
$file = @fopen(self::$serverUrl . "/@vite/client", "r");

if (!$file) {
error_clear_last();

if (in_array(wp_get_environment_type(), ['local', 'development']) && is_array(wp_remote_get(self::$serverUrl))) {
return true;
} else {
return false;
}

fclose($file);

return true;
}

public static function base_path()
Expand Down

0 comments on commit 03e146f

Please # to comment.