# Download

Download the latest version of Kontra.

## Source Code

- Global object production version
- Global object development version
- ES Module production version
- ES Module development version
- TGZ file
- Github repo

## Package mangers

- `$ npm install kontra`
- `$ yarn add kontra`

## CDN

### Global Object

    <script src="https://cdn.jsdelivr.net/npm/kontra@6.1.0/kontra.min.js"></script>

    <script src="https://cdn.jsdelivr.net/npm/kontra@6.1.0/kontra.js"></script>

### ES Module Import

    import kontra from 'https://cdn.jsdelivr.net/npm/kontra@6.1.0/kontra.min.mjs';

    import kontra from 'https://cdn.jsdelivr.net/npm/kontra@6.1.0/kontra.mjs';

## Custom Builds

As of kontra 6.0.0, custom builds can be achieved by using a module bundler such as Rollup or webpack. Kontra supports ES modules, allowing you to use tree-shaking to only bundle the code you need.

    // game.js
    import { Sprite, GameLoop } from 'kontra';

    let sprite = Sprite({
      x: 100,
      y: 100,
      dx: 2,
      width: 20,
      height: 40,
      color: 'red'
    });

    let loop = GameLoop({
      update() {
        sprite.update();
      },
      render() {
        sprite.render();
      }
    });

    loop.start();

    $ rollup game.js --format iife --file game.bundle.js