Skip to content
Package gopherjslib provides helpers for in-process GopherJS compilation.
Go
Branch: master
Clone or download
Pull request Compare This branch is 5 commits ahead, 1 commit behind go-on:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.travis.yml
LICENSE
README.md
error.go
gopherjslib.go

README.md

gopherjslib

Build Status GoDoc

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

go get -u github.com/shurcooL/gopherjslib

License

You can’t perform that action at this time.