Dear fellow open sorcerers,

I want to host a site on GitHub pages that shows examples of a JavaScript library I'm working on. The examples should of course use the latest version of the library.

For index.html to be able to use the library, I need to ship something like mylib.dist.js, just as I would on any site.

My question is, is there a way of doing this without checking mylib.dist.js into the repository? Is it best practise to have gh-pages be completely different from master and contain all kinds of compiled output?

A solution would be something like start scripts, configured in some file, kinda like how Heroku's Procfile works. However, I haven't found any docs on such a feature on GitHub.

For others that are as (perhaps irrationally) reluctant as me to source control dist bundles, do you have good alternatives?

  • 2
    You can upload built files to a release. Dec 9, 2016 at 14:43
  • 1
    @apsillers You should post that as an answer =]
    – Tim Malone
    Dec 10, 2016 at 20:24
  • What @TimMalone said! Dec 12, 2016 at 13:02
  • @apsillers I can't figure out how to load these files from a <script> tag. The links surfaced on the release page are simply download links. Jan 13, 2017 at 15:32
  • @AlexanderWallin Seems to work for me: I created this release and linked to the .js file I added as a binary in this fiddle: jsfiddle.net/0udg0d2c. What happens when you refer to the URL in a script tag? Or are you not seeing a link directly to the JS file in your release (e.g., it's only in a zip archive or something)?
    – apsillers
    Jan 13, 2017 at 17:14

1 Answer 1


Yes, you can do this by creating a release and attaching a binary to the release. Briefly, you do this by clicking the "Releases" link on the repository's main page and clicking the button to "Draft a new release". From there, look for the section to attach binaries to the release. (See the links in the first sentence for a detailed tutorial.)

Binaries are not part of your Git repository, but are stored separately by Github. Once you create the release, simply view it and copy the link to the binary you want to refer to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.