Created
August 10, 2017 01:58
-
-
Save oquirozm/32a0f45ad0213290179b50691bdb5c34 to your computer and use it in GitHub Desktop.
A simple gist that has the code to add requirejs to WordPress.
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 | |
// How to add require.js to WordPress. | |
wp_enqueue_script('requirejs', '//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.15/require.min.js'); | |
$app_base = get_template_directory_uri() . '/scripts'; | |
wp_localize_script( 'requirejs', 'require', array( | |
'baseUrl' => $app_base, | |
'deps' => array( $app_base . '/main.js') | |
)); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment