1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
gopherjslib
===========
[](https://travis-ci.org/shurcooL/gopherjslib) [](https://godoc.org/github.com/shurcooL/gopherjslib)
Package gopherjslib provides helpers for in-process GopherJS compilation.
All of them take the optional *Options argument. It can be used to set
a different GOROOT or GOPATH directory or to enable minification.
Example compiling Go code:
import "github.com/shurcooL/gopherjslib"
...
code := strings.NewReader(`
package main
import "github.com/gopherjs/gopherjs/js"
func main() { println(js.Global.Get("window")) }
`)
var out bytes.Buffer
err := gopherjslib.Build(code, &out, nil) // <- default options
Example compiling multiple files:
var out bytes.Buffer
builder := gopherjslib.NewBuilder(&out, nil)
fileA := strings.NewReader(`
package main
import "github.com/gopherjs/gopherjs/js"
func a() { println(js.Global.Get("window")) }
`)
builder.Add("a.go", fileA)
// And so on for each file, then:
err = builder.Build()
Installation
------------
```bash
go get -u github.com/shurcooL/gopherjslib
```
License
-------
- [MIT License](LICENSE)
|