From f5057073cc356071deba61fe583eb9ffda8de585 Mon Sep 17 00:00:00 2001 From: Brooke Date: Wed, 6 Oct 2021 22:07:27 -0700 Subject: [PATCH 1/2] Support Script Debug Understrap is already including the unminified version of assets. These can be useful when debugging locally, or if minification is happening elsewhere in the stack. WordPress uses the SCRIPT_DEBUG constant to tell core not to minify assets. This PR brings that logic to understrap --- inc/enqueue.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/inc/enqueue.php b/inc/enqueue.php index c05c18b8..52e9dbf9 100644 --- a/inc/enqueue.php +++ b/inc/enqueue.php @@ -17,13 +17,14 @@ if ( ! function_exists( 'understrap_scripts' ) ) { $the_theme = wp_get_theme(); $theme_version = $the_theme->get( 'Version' ); $bootstrap_version = get_theme_mod( 'understrap_bootstrap_version', 'bootstrap4' ); + $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; // Grab asset urls. - $theme_styles = '/css/theme.min.css'; - $theme_scripts = '/js/theme.min.js'; + $theme_styles = "/css/theme{$suffix}.css"; + $theme_scripts = "/js/theme{$suffix}.js"; if ( 'bootstrap4' === $bootstrap_version ) { - $theme_styles = '/css/theme-bootstrap4.min.css'; - $theme_scripts = '/js/theme-bootstrap4.min.js'; + $theme_styles = "/css/theme-bootstrap4{$suffix}.cs"; + $theme_scripts = "/js/theme-bootstrap4{$suffix}.js"; } $css_version = $theme_version . '.' . filemtime( get_template_directory() . $theme_styles ); From e3c0afce536043a4a3c48871bce52db95b410ed8 Mon Sep 17 00:00:00 2001 From: Brian Coords Date: Fri, 29 Oct 2021 15:57:10 -0700 Subject: [PATCH 2/2] fixes css filepath --- inc/enqueue.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/enqueue.php b/inc/enqueue.php index 52e9dbf9..704037df 100644 --- a/inc/enqueue.php +++ b/inc/enqueue.php @@ -23,7 +23,7 @@ if ( ! function_exists( 'understrap_scripts' ) ) { $theme_styles = "/css/theme{$suffix}.css"; $theme_scripts = "/js/theme{$suffix}.js"; if ( 'bootstrap4' === $bootstrap_version ) { - $theme_styles = "/css/theme-bootstrap4{$suffix}.cs"; + $theme_styles = "/css/theme-bootstrap4{$suffix}.css"; $theme_scripts = "/js/theme-bootstrap4{$suffix}.js"; }