Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created April 23, 2015 14:10
Show Gist options
  • Save ryanflorence/3024fa7e30a091ff8ea0 to your computer and use it in GitHub Desktop.
Save ryanflorence/3024fa7e30a091ff8ea0 to your computer and use it in GitHub Desktop.
// I'll have a entry point for the server app, like server.js,
// and and entry for the client app, like client.js
// in server.js I do this:
IS_CLIENT = false;
// in client.js I do this:
IS_CLIENT = true;
// Then anywhere in your code you can do this:
if (IS_CLIENT) {
doStuff();
}
// and then uglifyjs dead code eliminiation on client.js will see
// stuff like this
if (false) {
doStuff();
}
// and wipe it out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment