Skip to content
Example repository setup that deploys GHCJS programs to GitHub Pages
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Deploy GHCJS applications to GitHub pages

This repository demonstrates how to very simply deploy GHCJS-based applications to GitHubPages, using Travis CI.


  1. Clone this repository, or drop its .travis.yml file into an existing repository.
  2. Create a “Personal access tokens” on Make sure it has the “repo“ permission.
  3. Go to the settings page of your repository on Travis (e.g. Enable Travis, if not done yet. Under “Environment Variables”, store the personal access token from above, with name GITHUB_TOKEN.
  4. Wait.

If everything works, you will be using your GHCJS program on the Github Page URL for this project, e.g.


  • Why are you not using Stack or Nix?

    This setup uses plain Cabal (no stack, no nix), not because Stack or Nix are bad tool, but to make this accessible to as many developers as possible. But ideally, it should not matter what happens on Travis.

  • I have too many dependencies, and the build times out.

    If you trigger a build via the Travis web UI (top-right corner, “More Options” – “Trigger Build”), then travis will run an additional cache-warming stage where it will only build dependencies. This might help with the build. Let us know if this is still too slow, we have ideas.

  • Is the example program in this repository a good example of idiomatic ghcjs-dom use?

    No, surely not. I crudely forward-ported this demo that I wrote in 2015. If anyone wants to rewrite the Main.hs in this repository to follow best practices, that’d be amazing!

  • Can I use my own domain name?

    Yes. See and set the domain name in the fqdn field in .travis.yaml.

  • Anyways, what’s the deal?

    GHCJS is tricky to build, but thanks to hvr’s GHCJS PPA the pain is lessend.

Possible improvements (patches welcome!)

  • Document here how to do local development without GHCJS.

  • Find out and document how to handle data files that need to be available to the program, and/or data files that need to be available to the browser, in a way that works both locally (with GHC) and remotely (with GHCJS).

  • Clean up Main.hs (see question above).

  • Also build the program using regular GHC on travis, to see if that works.

  • Build the test suite, if present, and only deploy if it passes.


Please reports bugs and missing features at the GitHub bugtracker. This is also where you can find the source code.

ghcjs2gh-pages was written by Joachim Breitner and is licensed under a permissive MIT license.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.