Created
March 24, 2015 00:32
-
-
Save wpsmith/971c2fab9442aab0a2ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
wp_register_script( 'head-load', "/wp-includes/js/head.load$suffix.js", array(), '1.0.3', 0 ); | |
wp_register_script( 'my-head-loader', "path/to/my/head.loader$suffix.js", array( 'head-load' ), '1.0.3', 0 ); | |
$scripts = array( | |
'head' => 'wpHead', | |
'myJqueryFile' => "path/to/my/jquery.file$suffix.js", | |
'jQuery' => "//cdn.domain.com/jquery$suffix.js", | |
'underscorejs' => "path/to/underscore$suffix.js" | |
); | |
// Rename head to use wpHead. | |
wp_localize_script( 'head-load', 'head_conf', $scripts ); | |
// Keep HeadJS defaults and do whatever I want | |
//wp_localize_script( 'head-load', 'prefixScripts', $scripts ); | |
wp_enqueue_script( 'my-head-loader' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wpHead.test("undefined" !== typeof jQuery, [prefixScripts.underscorejs, prefixScripts.myJqueryFile], [prefixScripts.jQuery, prefixScripts.underscorejs, prefixScripts.myJqueryFile], function(){ | |
// Finally do something now that everything is ready! | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment