-
-
Save danielstgt/295af7405d1236bb18ebf874c4c1ebcc to your computer and use it in GitHub Desktop.
Create a debug only alias for console.log
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
MIX_JS_DEBUG="${APP_DEBUG}" |
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
['log', 'debug', 'warn', 'info', 'error', 'table', 'group', 'clear', 'count'].forEach(alias => { | |
if (typeof window[alias] === 'function') return; | |
window[alias] = process.env.MIX_JS_DEBUG === 'true' | |
? console[alias].bind(window.console) | |
: function () {}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
Alias for
console.log
with output only in debug mode (Laravel Mix based).Usage