Created
April 25, 2012 08:43
-
-
Save WolfieZero/2488270 to your computer and use it in GitHub Desktop.
JS Debug Quick Change
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
/** | |
* 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