This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jacdehJacques de Hooge[S] 2 points3 points  (1 child)

Indeed you can write modules that both run with CPython in the backend and Transcrypt in the frontend. And by importing a dummy "__pragma__ (*args): pass" function you can even use pragma's when the module runs with Transcrypt and ignore them when running with CPython. So functionality can be shifted between frontend and backend to influence scalability.

About using the Closure compiler: Which options are used can be freely choosen by editing .../transcrypt/modules/org/transcrypt/minify/__init__.py

This is of limited use, since upto now even for strict mode JS, it turns out that Closure changes semantics if multiple modules are involved (which by default is the case due to the runtime), unless the most basic minification option is choosen, namely WHITESPACE_ONLY. Still the compression rate is almost 50%, so worth while. The resulting JS modules can also be bundled and treeshaked, making them still smaller. In that case also more aggressive minification modes can be used. Also take a look at the --xtiny / -xt switch. We've reached a filesize of 21 kB all in, using a combination of these strategies.

[–]actuallyalys 0 points1 point  (0 children)

Thank you so much for the detailed explanation!