Skip to content

Instantly share code, notes, and snippets.

@dwood7399
Created March 22, 2014 19:39
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dwood7399/9713081 to your computer and use it in GitHub Desktop.
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
//
// 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