artasparks / glift

Go Lightweight Frontend
MIT License
115 stars 33 forks source link

Glift

Travis Build Status

The Go Lightweight Frontend

Glift is a modern javascript client for the game Go Glift was created to be a modern Go UI that supports mobile and desktop alike. It was built from the beginning to support:

Example

Here's a simple example, to create a game viewer for a game in div.

      glift.create({
        divId: 'myId',
        sgf: 'mysgfs/lee_sedol_vs_gu_li.sgf'
      });

See GliftGo.com if you want to see Glift in action and lots of code samples!

How it works:

Glift is an SVG based UI. When you invoke glift.create, Glift, looks at the div, determines the height and width of the div, and then draws an instance of the board.

Supported Browsers

The complied Glift JavaScript is completely self-contained and supports the following browsers:

Unsupported browsers

APIs

Glift is now released on a public, stable release!! All methods and options that are part of the stable 1.0 API have been marked with 'api: 1.0'. Similarly, if an option is available from 1.1 onward, then it will be marked 'api: 1.1'.

lifetime of the 1.0 release have been marked with api: 1.0. Options/methods that are on track to become supported have been marked @api(beta).

The currently supported methods support @api(1.0):

And the following options (see src/widgets/options/base_options.js)

Development

Although Glift was built for all major browsers, Glift was built on OSX, so these development docs assume a POSIX toolchain.

Glift uses Glup and Nodejs. Before you begin, make sure you've installed:

Gulp Instructions

Initialization. First, you'll need to initialize the repository with the relevant node modules:

npm install

This will create the necessary node_modules directory, which should be ignored via the .gitignore

Running Tests

There are several ways to run the qunit tests. To simply run the QUnit Tests via gulp:

gulp test

Or, once you've run gulp test or gulp update-html-srcs you can just open test/htmltests_gen/QunitTest.html in a browser and run the tests there (it's bit faster). Running the aformentioned commands dynamically inserts the sources into the HTML test templates in the test/htmltests directory and outputs the templated files to test/htmltests_gen.

Compilation

To compile the JavaScript, run:

gulp compile

Automated Build+Testing

To both build and run the tests, run:

gulp build-test

This is the command run by the Travis continuous integration suite.

Editing documentation

If you find yourself editing the Markdown docs, I use the node script Markdown Preview. It's then used via the following:

markdown-preview [options] <filename>

or in Vim:

au Filetype markdown command! PrevMarkdown !markdown-preiew %