z-boss
z-boss

Reputation: 17608

Is there any tools for automatic removal of comments from JavaScript code?

I'd like to have comments in my code, but I want them to be removed before deploying. Yes, it's not hard to write such a thing, but if it already exists… And how about comments in ASP pages?

Upvotes: 4

Views: 624

Answers (3)

Christian C. Salvadó
Christian C. Salvadó

Reputation: 827486

YUI Compressor in addition to removing comments and white-spaces, obfuscates local variables using the smallest possible variable name...

Besides the utility, there is the YUI Compressor Library for .NET, this library allows you to programmatically compress JavaScript and CSS, or use it automatically with MsBuild...

Upvotes: 7

zowens
zowens

Reputation: 1566

Are you going to compress at runtime? I'd use packer and compress your javascript through a generic handler.

Upvotes: 1

Jason Stevenson
Jason Stevenson

Reputation: 4000

Sounds like you are looking for a JSMin tool or similar.

There are many tools which you can purchase, but there are also some online tools you can use:

http://www.askapache.com/tools/online-compression-tool-compares-packer-jsmin-dojo-and-yui-compressor.html

http://www.askapache.com/online-tools/js-compress/

Good Luck!

Upvotes: 5

Related Questions