Mascara: Next Generation JavaScript compiler

Try it Download Buy About Documentation Blog Contact

On-the-fly translation

The release includes a proof-of-concept CGI-script that allows us to serve ES4 translated on the fly. I will not recommend it for any kind of production use: Since there is no caching involved, it is rather slow and unreliable. There are also some security issues.

However, if you like to develop by alternating between writing in an editor and reloading a browser, this script will make it easy and fun.

It is used like this:

1. Drop the root folder somewhere on your server where it can be executed, e.g. in the /cgi-bin folder. The script cgitranslate.py is the entry point, and should be made executable.

2. Configure the setting cgi_scriptbase in config.py to point to the folder where you keep your ES6 files (e.g /testfiles) You should now be able to request a translation like this:

/cgi-bin-or-whatever/cgitranslate.py?classtest.esx

(assuming classtest.es4 is a file in the root of the configured cgi_scriptbase folder)

3. Use it in HTML like this:

<script type="text/javascript" 
     src="/cgi/cgitranslate.py?classtest.esx">
script>

The release includes the file testweb/index.html which shows how a HTML-file can use an ECMAScript 6 file.

X Try!
Mascara JavaScript Generated JavaScript

Translating...
Show compiler settings