Replace tokens in js files before browserify

Doing it afterwards did some weird stuff with the templates
(browserify embeds them in the JS bundled file)
Fix github API url