I want to log to the console when I’m using un-minimized JavaScript files.
Comments are taken out already when I minimize JavaScript. I’m wondering if there’s a way I can write a command that isn’t commented out but will still be taken out when I minimize the JavaScript file.
If your goal is just to reduce the js size you can separate you logging functions into a separate file.
In your ‘main’ js add a function
function doLogging(object){}then in your separate logging functions file replace the function withfunction doLogging(object){/*your logging code*/};Just remember to include your main js before the logging js. When you minify just comment out the logging script tags from the html. This way you will only have one (or a couple of) empty function definitions in the minified js and one line of code calling those functions per loggingn action.