4

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?

1
  • I think this question needs more information. The obvious answer would be to say that many people do just fine using a text editor to generate JavaScript, but your comment about Script# seems to imply you're looking for some sort of automated tool…? Commented Sep 17, 2008 at 5:29

9 Answers 9

3

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

:P

Sign up to request clarification or add additional context in comments.

1 Comment

I can never decide which brain to use tho...brain fatigue :)
2

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.

Comments

1

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

Comments

1

Nice list: https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS

Comments

0

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.

Comments

0

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.

Comments

0

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

Comments

0

Kotlin can generate JavaScript out of Kotlin code. For Kotlin see http://kotlin.jetbrains.org/ and also http://devnet.jetbrains.com/thread/447468?tstart=0

Comments

0

Try Haxe.

It can target JavaScript, ActionScript and Neko bytecode. The language is close to Java.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.