HowTo: Compile app with Closure Compiler lazarus / 76-Pas2JS ---------------------------------------------------------------------- ps · 2020-07-04 11:51 "The Closure Compiler is a tool for making JavaScript download and run faster. Instead of compiling from a source language to machine code, it compiles from JavaScript to better JavaScript. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls." https://developers.google.com/closure/compiler We need little modification to our compiled javascript file . 1. Add window['rtl'] = rtl; to end of our compiled JS file 2. Create externs.js file On Windows: FILE: closure-footer.js Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i   window['rtl'] = rtl; FILE: externs.js Code: Javascript  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i /** @interface */function ControlsAndConstants() {}/** @type {number} */ControlsAndConstants.prototype.run; FILE: compile.bat Code: Text  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i type closure-footer.js >> app.jsjava -jar closure-compiler-v20200517.jar --compilation_level SIMPLE --js app.js --js_output_file app-min.js Note: Compilation level ADVANCED is not supported. ---------------------------------------------------------------------- d-_-b · 2020-07-28 22:37 QuoteNote: Compilation level ADVANCED is not supported. Which is sad because it the best compiler/transpiler for js out there, used by other languages like clojurescript. Thanks for testing it with SIMPLE, baby steps, before one run, i believe. ---------------------------------------------------------------------- lainz · 2020-07-28 23:53 Remember that these compilers are not perfect, I usually get JavaScript broken with these tools, so try it with care. ---------------------------------------------------------------------- ps · 2020-07-30 19:00 Closure Compiler is amazing (esp. with ADVANCED), but there is problem. See this: https://bugs.freepascal.org/view.php?id=37114 ---------------------------------------------------------------------- lainz · 2020-07-31 22:06 Yes, it's good. But anyways remember testing everything once compiled... things may fail.