Skip to content

Commit

Permalink
feat(perf): don't enqueue CSS if ads are not to be displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
adekbadek committed Nov 27, 2023
1 parent df35ee7 commit 2c70480
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions includes/class-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ public static function activation_hook() {
* Enqueue front-end styles.
*/
public static function enqueue_scripts() {
if ( ! newspack_ads_should_show_ads() ) {
return;
}

\wp_register_style(
'newspack-ads-frontend',
plugins_url( '../dist/frontend.css', __FILE__ ),
Expand Down

0 comments on commit 2c70480

Please sign in to comment.