tags:

views:

244

answers:

7

Are there any good tools to generate JavaScript? I remember in .NET, there was Script# - don't know its status today.

Anyone have experience with any tools?

A: 

There is currently a lot of tools to generate JavaScript, like GWT.

But giving you a good answer really depends on what is your originator language and what king of JavaScript functionnality you want to use.

gizmo
+1  A: 

Latest version of Script# was posted less than a month ago. Nikhil continues to actively work on that project and it's a very good tool for generating JavaScript code from C#. It is actively used in a couple of different internal Microsoft projects.

Some of the benefits of Script# are:

  • Intellisense
  • Build errors at compile time
  • Refactoring support
  • Documentation support
  • FxCop code analysis
  • MSBuild support
spoon16
A: 

Google Web Toolkit is one option. Write Java code, debug it with a standard Java debugger, then press the "Compile" button and turn it into highly-optimized JavaScript. It generates completely separate JavaScript for each major browser family (IE, Firefox, Safari, etc.).

Very mature, very powerful, and easy to embed into an existing site. One downside is that the UIs it creates are ugly nested tables.

dmazzoni
A: 

I use my keyboard, a text editor and my brain to generate JavaScript.

:P

Jason Bunting
A: 

I've used D templates (think C++ without the pain and you'll be 50% there) to generate a AJAX based Object proxy.

BCS
+2  A: 

As others have said, GWT is a very good option. To summarize some good points:

  • fast, very portable code using deferred binding; only loads the code that works on the user's browser, and only loads functions that are actually called; also, they're compressed
  • reliability; very few known issues
  • easier debugging using a Java-based IDE; you can also look directly at un-obfuscated javascript if you want to, but it seems (based on some reports I've seen & personal experience) that you basically never need this
  • good library support including a nice inline javascript interface, the ability to use existing Java libraries, and special support for ajax / rpc calls
  • extensible & stylistically flexible; you can fine-tune all styles with your own css rules, and extend the Widget base with your own Java subclasses

So I humbly disagree with dominic that the results are ugly since it is up to the coder to 'prettify' the basic functionality with their own css rules and other decorations. It would be the same mistake to call HTML 'ugly' - if you don't try hard, it isn't pretty, but the power and flexibility is in the hands of the coder.

Oh, and it's open source, too.

Tyler
A: 

Try haXe.

It can target javascript, actionscript and Neko bytecode. The language is close to Java.

tomdemuyt