getVersion(); function getUrl($fileName) { global $version; if (file_exists($fileName)) $fileVersion = strftime('%G%m%d%H%M%S', filemtime($fileName)); else $fileVersion = $version; return "$fileName?$fileVersion"; } function js($fileName) { return ''."\n"; } function css($fileName) { return ''."\n"; } function getWebpackAssets() { $wpConfig = json_decode(file_get_contents('webpack.config.json')); $buildDir = $wpConfig->buildDir; $serverPath = ''; if (_DEV_MODE) { $devServerPort = $wpConfig->devServerPort; $host = $_SERVER['SERVER_NAME']; $serverPath = "http://$host:$devServerPort"; } $wpAssets = json_decode(file_get_contents("$buildDir/webpack-assets.json")); $jsFiles = []; foreach ($wpAssets as $name => $asset) if (!empty($name) && $name != '_empty_' && $name != 'main' && property_exists($asset, 'js')) $jsFiles[] = $serverPath . $asset->js; $jsFiles[] = $serverPath . $wpAssets->{''}->js[0]; $jsFiles[] = $serverPath . $wpAssets->main->js; return $jsFiles; }