How do I compile a html javascript package into a single, static binary?
How do I compile a html javascript package into a single, static binary?
Title. I'm trying to compile this but I can't seem to do so with node.js.
Thanks in advance.
You're viewing a single thread.
View all comments
11
comments
You could do it pretty easily in Go.
Basically just use embedfs to add your javascript and HTML.
Here's a complete working example with a http server from that page:
package main import ( "embed" "log" "net/http" ) //go:embed internal/embedtest/testdata/*.txt var content embed.FS func main() { mutex := http.NewServeMux() mutex.Handle("/", http.FileServer(http.FS(content))) err := http.ListenAndServe(":8080", mutex) if err != nil { log.Fatal(err) } }
2 1 ReplyI see you want a screen saver and this just runs an app to view in your browser. There are other methods but they are a bit trickier. It's not too hard to add an embedded interpreter but you'd probably have to do some porting to get it drawing to a native canvas.
1 0 Reply
You've viewed 11 comments.
Scroll to top