Skip to content

Commit

Permalink
Updated generated html to point to bundle url;
Browse files Browse the repository at this point in the history
  • Loading branch information
RGBboy committed Aug 6, 2014
1 parent c620818 commit d71a21d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions bin/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -313,7 +317,7 @@ function getHTML (cb) {
+ ent.encode(s) + '"></script>'
;
}).join('\n')
+ '<script>' + bundle + '</script>'
+ '<script src="/__testling/' + bundleId + '.js"></script>'
+ after
+ '</body></html>'
);
Expand Down

0 comments on commit d71a21d

Please sign in to comment.