From 4ab11733453cf1516893b5800187aa1281a57695 Mon Sep 17 00:00:00 2001 From: Ben Word Date: Fri, 24 Oct 2014 13:06:36 -0500 Subject: [PATCH] Move JavaScript to footer Ref https://github.com/h5bp/html5-boilerplate/issues/1605 --- CHANGELOG.md | 1 + lib/scripts.php | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5985208..63e9e9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### HEAD +* Move JavaScript to footer * Update hEntry schema to use `updated` instead of `published` * Move variables into `main.less` * Add `roots_body_class` function that checks for page slug in `body_class` diff --git a/lib/scripts.php b/lib/scripts.php index ac3f22f..573ff1f 100644 --- a/lib/scripts.php +++ b/lib/scripts.php @@ -8,7 +8,7 @@ * Enqueue scripts in the following order: * 1. jquery-1.11.1.min.js via Google CDN * 2. /theme/assets/js/vendor/modernizr.min.js - * 3. /theme/assets/js/scripts.js (in footer) + * 3. /theme/assets/js/scripts.js * * Google Analytics is loaded after enqueued scripts if: * - An ID has been defined in config.php @@ -46,7 +46,7 @@ function roots_scripts() { */ if (!is_admin() && current_theme_supports('jquery-cdn')) { wp_deregister_script('jquery'); - wp_register_script('jquery', $assets['jquery'], array(), null, false); + wp_register_script('jquery', $assets['jquery'], array(), null, true); add_filter('script_loader_src', 'roots_jquery_local_fallback', 10, 2); } @@ -54,7 +54,7 @@ function roots_scripts() { wp_enqueue_script('comment-reply'); } - wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, false); + wp_enqueue_script('modernizr', get_template_directory_uri() . $assets['modernizr'], array(), null, true); wp_enqueue_script('jquery'); wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, true); } @@ -79,7 +79,7 @@ add_action('wp_head', 'roots_jquery_local_fallback'); /** * Google Analytics snippet from HTML5 Boilerplate - * + * * Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM */ function roots_google_analytics() { ?>