JavaScript and Stylus conditional compilation (debug mode) in Grunt
Often you want some code to be executed only in development environment but not in production. It’d be convenient to have a tool that will remove such code on deploy.
Debug mode enables when Grunt runs with --debug key. You can determine it in your Gruntfile:
in UglifyJS you can define global variables, kind of preprocessor: variable will be replaced with its value and all the code that became dead (if (false) { /* Like this */ } will be removed.
You can define such variables via command line or via Gruntfile: