tmedwards / tweego

Tweego is a free (gratis and libre) command line compiler for Twine/Twee story formats, written in Go.
https://www.motoslave.net/tweego
BSD 2-Clause "Simplified" License
124 stars 23 forks source link

JS scripts outside the SugarCube envelope #6

Closed ezsh closed 4 years ago

ezsh commented 4 years ago

When there is a lot of JavaScript code in the game, it is tedious to declare global functions via assignments to the window object. It would be nice if there will be a way to tag .js files with global declarations so that Tweego could put them in a normal <script> tag instead of the SugarCube (or another format) scope. For example, a special comment at the beginning of the .js file could do the trick.

tmedwards commented 4 years ago

That's the purpose of the module option (-m SRC, --module=SRC).

SEE: Options in the manual.

ezsh commented 4 years ago

Thanks, but the option is a bit different: it requires to keep those modules in its own directory, while I ask for a tags in the source files. Although I'll completely understand if you reject this change.