COMMUNITY

Is there a way to include comments in generated JS files?

haxe-js

(Joshua Granick) #1

You can do untyped __js__ ("// insert my comment"); but this appends a semicolon at the end of your comment.

Is there a way to inject a line of code in the generated JavaScript, without a semicolon?


(Valentin Lemière) #2

I thought haxe.macro.Compiler.includeFile might do it (https://gist.github.com/ibilon/90d5b4f0c20f6bfcd380788ce680f6db) but it also adds a semicolon.

Even the new js.Syntax.code https://api.haxe.org/v/development/js/Syntax.html
adds one, but maybe it could have an argument to disable it?


(Randy Maxwell) #3

@singmajesty, All

Has a fairly good way to do Comments in JavaScript, C++, C#, Java and Python (what I have tested).
Other Haxe output languages are checked for in sample code near the end but untested by me.

Thanks to the Haxe Forum members for the solution!