diff --git a/doc/lib.md b/doc/lib.md index e551202..75c9b62 100644 --- a/doc/lib.md +++ b/doc/lib.md @@ -87,12 +87,12 @@ If you're using LESS, make sure you compile the files to the proper locations: JavaScript is loaded in the following order: -1. `/theme/assets/js/vendor/modernizr-2.6.2.min.js` -2. `jquery-1.9.0.min.js` via Google CDN with local fallback -3. `/theme/assets/js/plugins.js` -4. `/theme/assets/js/main.js` +1. `jquery-1.9.0.min.js` via Google CDN with local fallback +2. `/theme/assets/js/vendor/modernizr-2.6.2.min.js` +3. `/theme/assets/js/plugins.js` (in footer) +4. `/theme/assets/js/main.js` (in footer) -jQuery is loaded in `head.php` using the same method from HTML5 Boilerplate: grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline. It's kept in the header instead of footer to avoid conflicts with plugins. +jQuery is loaded using the same method from HTML5 Boilerplate: grab Google CDN's jQuery, with a protocol relative URL; fallback to local if offline. It's kept in the header instead of footer to avoid conflicts with plugins. `plugins.js` contains a minified version of all the latest Bootstrap plugins. diff --git a/lib/scripts.php b/lib/scripts.php index 8b74aa2..bb35df9 100644 --- a/lib/scripts.php +++ b/lib/scripts.php @@ -9,10 +9,10 @@ * 4. /child-theme/style.css (if a child theme is activated) * * Enqueue scripts in the following order: - * 1. /theme/assets/js/vendor/modernizr-2.6.2.min.js - * 2. jquery-1.9.0.min.js via Google CDN - * 3. /theme/assets/js/plugins.js - * 4. /theme/assets/js/main.js + * 1. jquery-1.9.0.min.js via Google CDN + * 2. /theme/assets/js/vendor/modernizr-2.6.2.min.js + * 3. /theme/assets/js/plugins.js (in footer) + * 4. /theme/assets/js/main.js (in footer) */ function roots_scripts() { @@ -30,7 +30,7 @@ function roots_scripts() { // It's kept in the header instead of footer to avoid conflicts with plugins. if (!is_admin()) { wp_deregister_script('jquery'); - wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js', array('modernizr'), null, false); + wp_register_script('jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js', false, null, false); } if (is_single() && comments_open() && get_option('thread_comments')) { @@ -38,10 +38,10 @@ function roots_scripts() { } wp_register_script('modernizr', get_template_directory_uri() . '/assets/js/vendor/modernizr-2.6.2.min.js', false, null, false); - wp_register_script('roots_plugins', get_template_directory_uri() . '/assets/js/plugins.js', false, null, false); - wp_register_script('roots_main', get_template_directory_uri() . '/assets/js/main.js', false, null, false); - wp_enqueue_script('modernizr'); + wp_register_script('roots_plugins', get_template_directory_uri() . '/assets/js/plugins.js', false, null, true); + wp_register_script('roots_main', get_template_directory_uri() . '/assets/js/main.js', false, null, true); wp_enqueue_script('jquery'); + wp_enqueue_script('modernizr'); wp_enqueue_script('roots_plugins'); wp_enqueue_script('roots_main'); }