Created
March 22, 2014 19:39
-
-
Save dwood7399/9713081 to your computer and use it in GitHub Desktop.
Enqueue JS from dev files when WP_DEBUG is true, else enqueue combined, minimized file
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
// | |
// Enqueue JS from dev files or combined, minimized file | |
// | |
if( ! function_exists( 'bfc_enqueue_script' ) ) { | |
function bfc_enqueue_script() | |
{ | |
if ( defined('WP_DEBUG') AND WP_DEBUG ) { | |
wp_enqueue_script('lazyload', get_stylesheet_directory_uri().'/js/dev/jquery.lazyload.js', array( 'jquery' ), null, true ); | |
wp_enqueue_script('bfcScripts', get_stylesheet_directory_uri().'/js/dev/scripts.js', array( 'jquery', 'lazyload' ), null, true ); | |
} | |
else { | |
wp_enqueue_script('theme-functions', get_stylesheet_directory_uri().'/js/bfc-functions.min.js', array( 'jquery' ), null, true ); | |
} | |
} | |
} | |
add_action( 'wp_enqueue_scripts', 'bfc_enqueue_script' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment