Skip to content

Shim Javascript Code #111

Closed
Closed
@ajhager

Description

@ajhager

I keep having the need to provide custom javascript with a GopherJS library. For something like AngularJS, it seems fair to ask a user to include the library manually, but with custom library code it becomes a chore.

I created a utility to get around this https://github.com/ajhager/shmi, but it adds a manual build step. I wonder if it would be helpful to provide a mechanism to bundle javascript automatically using GopherJS.

There are a few ways this could be handled, but I suggest perhaps:

import "github.com/gopherjs/gopherjs/js"

js.Provide("./myjscode.js")
// OR
js.Import("./myjscode.js")
// OR
js.Bundle("./myjscode.js")

The compiler could make sure any javascript files would only be bundled once, and raise an error if the files don't exist.

I am happy to work on this, but I would appreciate some feedback.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions