Skip to content

Commit

Permalink
Refactor conditional logic for script path assignment
Browse files Browse the repository at this point in the history
Co-authored-by: Weston Ruter <westonruter@google.com>
  • Loading branch information
ShyamGadde and westonruter authored Nov 13, 2024
1 parent 0a1354b commit 6e18901
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion plugins/web-worker-offloading/hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
function plwwo_register_default_scripts( WP_Scripts $scripts ): void {
// The source code for partytown.js is built from <https://github.com/BuilderIO/partytown/blob/b292a14047a0c12ca05ba97df1833935d42fdb66/src/lib/main/snippet.ts>.
// See webpack config in the WordPress/performance repo: <https://github.com/WordPress/performance/blob/282a068f3eb2575d37aeb9034e894e7140fcddca/webpack.config.js#L84-L130>.
$partytown_js_path = '/build/partytown.js';
if ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) {
$partytown_js_path = '/build/debug/partytown.js';
} else {
$partytown_js_path = '/build/partytown.js';
}

$partytown_js = file_get_contents( __DIR__ . $partytown_js_path ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- It's a local filesystem path not a remote request.
Expand Down

0 comments on commit 6e18901

Please sign in to comment.