Skip to content

Commit

Permalink
⚡️ Defer script loading
Browse files Browse the repository at this point in the history
See #196
  • Loading branch information
MatzeKitt committed Apr 16, 2024
1 parent 0f42636 commit 1974d25
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions inc/class-embed-privacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -1583,7 +1583,7 @@ public function register_assets() {
$js_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/js/embed-privacy' . $suffix . '.js';
$file_version = $is_debug ? \filemtime( \EPI_EMBED_PRIVACY_BASE . 'assets/js/embed-privacy' . $suffix . '.js' ) : \EMBED_PRIVACY_VERSION;

\wp_register_script( 'embed-privacy', $js_file_url, [], $file_version );
\wp_register_script( 'embed-privacy', $js_file_url, [], $file_version, [ 'strategy' => 'defer' ] );
}

// Astra is too greedy at its CSS selectors
Expand All @@ -1601,7 +1601,7 @@ public function register_assets() {
$js_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/js/elementor-video' . $suffix . '.js';
$file_version = $is_debug ? \filemtime( \EPI_EMBED_PRIVACY_BASE . 'assets/js/elementor-video' . $suffix . '.js' ) : \EMBED_PRIVACY_VERSION;

\wp_register_script( 'embed-privacy-elementor-video', $js_file_url, [], $file_version );
\wp_register_script( 'embed-privacy-elementor-video', $js_file_url, [], $file_version, [ 'strategy' => 'defer' ] );

$css_file_url = \EPI_EMBED_PRIVACY_URL . 'assets/style/elementor' . $suffix . '.css';
$file_version = $is_debug ? \filemtime( \EPI_EMBED_PRIVACY_BASE . 'assets/style/elementor' . $suffix . '.css' ) : \EMBED_PRIVACY_VERSION;
Expand Down

0 comments on commit 1974d25

Please sign in to comment.