Skip to content

Instantly share code, notes, and snippets.

@WolfieZero
Created April 25, 2012 08:43
Show Gist options
  • Save WolfieZero/2488270 to your computer and use it in GitHub Desktop.
Save WolfieZero/2488270 to your computer and use it in GitHub Desktop.
JS Debug Quick Change
/**
* If you do a lot of JS development, having a global function to include the
* source URL that corrects the URL if the DEBUG_JS flag is set to true or not.
*/
define('DEBUG_JS', false);
/**
* Javascript Include
* Includes Javascript according to if it's in debug mode or not
*
* @param string $src The original, uncompressed, source file of the JS
* @param string $ext='.js' The extension of the file
* @return string The file path
*/
function jsFileInc($src, $ext='.js') {
if (!DEBUG_JS) $src = str_replace($ext, '.min'.$ext, $src);
return $src;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment