Using 'JSMin' to remove commented-out code from JavaScript
I use Douglas Crockford's 'JSMin' minifier a lot.
I modified it to keep newlines so I can look through the results. You can find it at:
'https://github.com/Bert-Beckwith/myjsmin'
'jsmin.c' is a small C program that removes JavaScript comments and excess whitespace.
I often comment out old code rather than remove the code, so I use 'JSMin' to look at what is left. Afterwards I say ':g/^$/d' in 'vim' to remove blank lines. I really should just remove the old code and learn to use my source control system better.
I also use 'JSMin' to minify my game, partly so that the input to 'UglifyJS' is smaller. I use an online version of 'UglifyJS' as my Linux system at home is a bit too old to run it. 'JSMin' is small and fast - I can run it in the background whilst playing my game.
Comments
Post a Comment