Getting familiar with GopherJS on the command line

The gopherjs command is very similar to the go command. For example, to transpile a Go program into its JavaScript representation, we issue the gopherjs build command like this:

$ gopherjs build

To build a GopherJS project and minify the produced JavaScript source file, we specify the -m flag along with the gopherjs build command:

$ gopherjs build -m

When we perform a build operation, GopherJS will create both a .js source file and a .js.map source file.

The .js.map files are called source maps. They help us map a minified JavaScript source file back to its unbuilt state. This feature comes in handy when we chase down errors using the web browser console.

The JavaScript source file, generated by GopherJS, can be imported as an external JavaScript source file into a web page using the script tag. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.187.62