From: Tim Meadowcroft <meer...@gmail.com>
Date: Wed, 9 May 2012 10:42:33 -0700 (PDT)
Local: Wed, May 9 2012 1:42 pm
Subject: Re: Removing code for production
On Sunday, 8 April 2012 19:07:11 UTC+1, Tauren Mills wrote: I added a feature to uglifyjs for precisely this sort of "production" use - > I'd like to remove some code for production and think UglifyJS is the tool in this way I use uglifyjs in a way similar to the C preprocessor to entirely remove code blocks by telling uglifyjs it should consider certain symbols to have specific defined values, and then using the inherent "dead code removal" feature. https://github.com/mishoo/UglifyJS#use-as-a-code-pre-processor In particular, my "un-uglified code" includes if (typeof DEVELOPMENT === "undefined") DEVELOPMENT = true; This way, in development, I can have things like if (DEVELOPMENT) { and then, when I uglify my code with command lines args "--define I don't really need both symbols, but it sometimes makes my intent clearer. I also use this for setting certain flags or initialising values in Cheers -- You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||