Skip to content

Commit

Permalink
Move JavaScript to footer
Browse files Browse the repository at this point in the history
  • Loading branch information
retlehs committed Oct 24, 2014
1 parent 2978eb3 commit 4ab1173
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
8 changes: 4 additions & 4 deletions lib/scripts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -46,15 +46,15 @@ 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);
}

if (is_single() && comments_open() && get_option('thread_comments')) {
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);
}
Expand All @@ -79,7 +79,7 @@ function roots_jquery_local_fallback($src, $handle = null) {

/**
* Google Analytics snippet from HTML5 Boilerplate
*
*
* Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
*/
function roots_google_analytics() { ?>
Expand Down

0 comments on commit 4ab1173

Please sign in to comment.