Add grunt.js build script
- Move Bootstrap LESS files into new subdirectory - Change app.css to app.less, add @import's to utilize Bootstrap variables and mixins - Remove plugins.js and main.js - Move Bootstrap JS plugins into new subdirectory - Add new _main.js file with example DOM-based routing script that works off the WordPress body_class - lib/scripts.php has been updated to remove all extra CSS and JS files and also places JavaScript in the footer
This commit is contained in:
@@ -3,44 +3,28 @@
|
||||
* Scripts and stylesheets
|
||||
*
|
||||
* Enqueue stylesheets in the following order:
|
||||
* 1. /theme/assets/css/bootstrap.css
|
||||
* 2. /theme/assets/css/bootstrap-responsive.css
|
||||
* 3. /theme/assets/css/app.css
|
||||
* 4. /child-theme/style.css (if a child theme is activated)
|
||||
* 1. /theme/assets/css/main.min.css
|
||||
*
|
||||
* Enqueue scripts in the following order:
|
||||
* 1. /theme/assets/js/vendor/modernizr-2.6.2.min.js (in head.php)
|
||||
* 2. jquery-1.8.2.min.js via Google CDN (in head.php)
|
||||
* 3. /theme/assets/js/plugins.js
|
||||
* 4. /theme/assets/js/main.js
|
||||
* 3. /theme/assets/js/scripts.min.js
|
||||
*/
|
||||
|
||||
function roots_scripts() {
|
||||
wp_enqueue_style('roots_bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.css', false, null);
|
||||
wp_enqueue_style('roots_bootstrap_responsive', get_template_directory_uri() . '/assets/css/bootstrap-responsive.css', array('roots_bootstrap'), null);
|
||||
wp_enqueue_style('roots_app', get_template_directory_uri() . '/assets/css/app.css', false, null);
|
||||
wp_enqueue_style('roots_main', get_template_directory_uri() . '/assets/css/main.min.css', false, '276c177e19c5e182a0258a0b5ec46d53');
|
||||
|
||||
// Load style.css from child theme
|
||||
if (is_child_theme()) {
|
||||
wp_enqueue_style('roots_child', get_stylesheet_uri(), false, null);
|
||||
}
|
||||
|
||||
// jQuery is loaded in header.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.
|
||||
if (!is_admin()) {
|
||||
wp_deregister_script('jquery');
|
||||
wp_register_script('jquery', '', '', '1.8.2', false);
|
||||
wp_register_script('jquery', '', '', '1.8.2', true);
|
||||
}
|
||||
|
||||
if (is_single() && comments_open() && get_option('thread_comments')) {
|
||||
wp_enqueue_script('comment-reply');
|
||||
}
|
||||
|
||||
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('roots_plugins');
|
||||
wp_enqueue_script('roots_main');
|
||||
wp_register_script('roots_scripts', get_template_directory_uri() . '/assets/js/scripts.min.js', false, '451f9387735e7c266d1fe20c1c58e94a', true);
|
||||
wp_enqueue_script('roots_scripts');
|
||||
}
|
||||
|
||||
add_action('wp_enqueue_scripts', 'roots_scripts', 100);
|
||||
|
||||
Reference in New Issue
Block a user