Merge pull request #1180 from roots/js-to-footer
Move JavaScript to footer
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
### HEAD
|
### HEAD
|
||||||
|
* Move JavaScript to footer
|
||||||
* Update hEntry schema to use `updated` instead of `published`
|
* Update hEntry schema to use `updated` instead of `published`
|
||||||
* Move variables into `main.less`
|
* Move variables into `main.less`
|
||||||
* Add `roots_body_class` function that checks for page slug in `body_class`
|
* Add `roots_body_class` function that checks for page slug in `body_class`
|
||||||
|
|||||||
@@ -103,6 +103,9 @@ module.exports = function(grunt) {
|
|||||||
['assets/css/main.min.css']
|
['assets/css/main.min.css']
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
extra: {
|
||||||
|
shiv: false
|
||||||
|
},
|
||||||
uglify: true,
|
uglify: true,
|
||||||
parseFiles: true
|
parseFiles: true
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* Enqueue scripts in the following order:
|
* Enqueue scripts in the following order:
|
||||||
* 1. jquery-1.11.1.min.js via Google CDN
|
* 1. jquery-1.11.1.min.js via Google CDN
|
||||||
* 2. /theme/assets/js/vendor/modernizr.min.js
|
* 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:
|
* Google Analytics is loaded after enqueued scripts if:
|
||||||
* - An ID has been defined in config.php
|
* - An ID has been defined in config.php
|
||||||
@@ -46,7 +46,7 @@ function roots_scripts() {
|
|||||||
*/
|
*/
|
||||||
if (!is_admin() && current_theme_supports('jquery-cdn')) {
|
if (!is_admin() && current_theme_supports('jquery-cdn')) {
|
||||||
wp_deregister_script('jquery');
|
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);
|
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('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('jquery');
|
||||||
wp_enqueue_script('roots_js', get_template_directory_uri() . $assets['js'], array(), null, true);
|
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
|
* Google Analytics snippet from HTML5 Boilerplate
|
||||||
*
|
*
|
||||||
* Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
|
* Cookie domain is 'auto' configured. See: http://goo.gl/VUCHKM
|
||||||
*/
|
*/
|
||||||
function roots_google_analytics() { ?>
|
function roots_google_analytics() { ?>
|
||||||
|
|||||||
Reference in New Issue
Block a user