From d71a21d164add3f97b432236d9d0456f7dcbd2a1 Mon Sep 17 00:00:00 2001 From: RGBboy Date: Wed, 6 Aug 2014 14:44:35 +1200 Subject: [PATCH] Updated generated html to point to bundle url; Fixes #89; --- bin/cmd.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/cmd.js b/bin/cmd.js index 1859849..0c3a4ef 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -26,6 +26,7 @@ var path = require('path'); var prelude = fs.readFileSync(__dirname + '/../bundle/prelude.js', 'utf8'); var bundle, launch; +var bundleId = Math.floor(Math.pow(16,8)*Math.random()).toString(16); var scripts = []; var htmlQueue = []; var pending = 4; @@ -61,7 +62,6 @@ if ((process.stdin.isTTY || argv._.length) && argv._[0] !== '-') { ); return; } - var bundleId = Math.floor(Math.pow(16,8)*Math.random()).toString(16); if (pkg.testling.preprocess) { pending += 1; @@ -160,6 +160,10 @@ var server = http.createServer(function (req, res) { res.setHeader('content-type', 'text/html'); getHTML(function (html) { res.end(html) }); } + else if (u.replace(/\/$/, '') === '/__testling/' + bundleId + '.js') { + res.setHeader('content-type', 'application/javascript'); + res.end(bundle); + } else if (u.split('/')[1] === '__testling') { req.url = req.url.replace(/^\/__testling/, ''); ecstatic(req, res); @@ -313,7 +317,7 @@ function getHTML (cb) { + ent.encode(s) + '">' ; }).join('\n') - + '' + + '' + after + '' );