tags:

views:

26

answers:

1

Hi,

I am wondering if anyone knows of an open source c# library for beautifying javascript. I would like to make use of such a library within my asp net website to make debugging messy javascript easier.

There are currently many online websites for this (ie. http://jsbeautifier.org/) however I would like to have access to such a utility within c#, even if it is just a wrapper for communicating with an online API.

Many Thanks, Chris

+1  A: 

The site you pointed out suggests a command line tool. Wouldn't it be enough for you?

To beautify from the command-line you can use provided beautify-cl.js script, using Rhino javascript engine. See the file contents for the details.

GôTô
Problem Solved! I just downloaded the package from github and there is a c-sharp folder which contains a port in JSBeautify.cs :-D
Chris
Great news, maybe that will come in useful for me as well in the future. Thanks for sharing!
GôTô
http://github.com/einars/js-beautify/blob/master/unmaintained/c-sharp/JSBeautify.cs
Chris