Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Don't enqueue scripts if asset file is not there
Browse files Browse the repository at this point in the history
  • Loading branch information
opr committed Sep 5, 2023
1 parent c6da722 commit f50666b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Domain/Services/JetpackWooCommerceAnalytics.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ public function register_assets() {
return;
}
$asset_file = include dirname( __FILE__ ) . '/../../../build/wc-blocks-jetpack-woocommerce-analytics.asset.php';
$this->asset_api->register_script( 'wc-blocks-jetpack-woocommerce-analytics', 'build/wc-blocks-jetpack-woocommerce-analytics.js', array_merge( array( 'wc-blocks' ), $asset_file['dependencies'] ) );
if ( is_array( $asset_file['dependencies'] ) ) {
$this->asset_api->register_script( 'wc-blocks-jetpack-woocommerce-analytics', 'build/wc-blocks-jetpack-woocommerce-analytics.js', array_merge( array( 'wc-blocks' ), $asset_file['dependencies'] ) );
}
}

/**
Expand Down

0 comments on commit f50666b

Please sign in to comment.