17 comments

[ 3.1 ms ] story [ 51.7 ms ] thread
Does it handle defining functions? I can’t get them to work.
I'm afraid it cannot, since those functions would need to be compiled into WASM first, and that's something the browser can't do.

What I could add, though, is a bunch of "standard" functions (like the ones found in Hugo, for example).

Noted!

Besides the comment regarding using a Go interpreter, you can definitely compile inside of the browser and then load that WASM module into the current session.
Interesting that it's easier to run Go in browser using WebAssembly than to write a templating engine that uses Go's syntax in JS from scratch. :)
Is it either interesting or easier though?
(comment deleted)
This is cool! Do you think you could get Hugo to run in the browser this way so you could show live-previews in the browser without having to run Hugo locally?
It... should, i think? I'll try!

Binary size is the main issue with Go WASM, the binary on this is 4MB, and it only does templating.

TinyGo won't work because it doesn't have reflect (which I need for parsing arbitrary JSON).

But I'll give it a spin. Thanks!

Hi @ricardbejarano

First of all, I really interested with this project and I see there is a room for improvement, mind to open source the code?

thanks randomguy011

Great project, well-bounded and insightful! Do you think about making it open source? I was thinking about trying to use another JSON library and make it work with tinygo, but don't want to repeat the work.