Minify serves the require kernel.
parent
e33c5a3aac
commit
3da1464ae0
|
@ -143,11 +143,6 @@ async.waterfall([
|
||||||
});
|
});
|
||||||
|
|
||||||
//serve static files
|
//serve static files
|
||||||
app.get('/static/js/require-kernel.js', function (req, res, next) {
|
|
||||||
res.header("Content-Type","application/javascript; charset: utf-8");
|
|
||||||
res.write(minify.requireDefinition());
|
|
||||||
res.end();
|
|
||||||
});
|
|
||||||
var assetCache = new CachingMiddleware;
|
var assetCache = new CachingMiddleware;
|
||||||
app.all('/static/js/:filename', assetCache.handle, minify.minifyJS);
|
app.all('/static/js/:filename', assetCache.handle, minify.minifyJS);
|
||||||
app.get('/static/*', function(req, res)
|
app.get('/static/*', function(req, res)
|
||||||
|
|
|
@ -201,7 +201,6 @@ function lastModifiedDate(callback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.requireDefinition = requireDefinition;
|
|
||||||
function requireDefinition() {
|
function requireDefinition() {
|
||||||
return 'var require = ' + RequireKernel.kernelSource + ';\n';
|
return 'var require = ' + RequireKernel.kernelSource + ';\n';
|
||||||
}
|
}
|
||||||
|
@ -226,12 +225,17 @@ function getFileCompressed(filename, callback) {
|
||||||
function getFile(filename, callback) {
|
function getFile(filename, callback) {
|
||||||
if (filename == 'ace.js') {
|
if (filename == 'ace.js') {
|
||||||
getAceFile(callback);
|
getAceFile(callback);
|
||||||
|
} else if (filename == 'require-kernel.js') {
|
||||||
|
callback(undefined, requireDefinition());
|
||||||
} else {
|
} else {
|
||||||
fs.readFile(JS_DIR + filename, "utf8", callback);
|
fs.readFile(JS_DIR + filename, "utf8", callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function fileExists(filename, callback) {
|
function fileExists(filename, callback) {
|
||||||
|
if (filename == 'require-kernel.js') {
|
||||||
|
callback(undefined, true);
|
||||||
|
} else {
|
||||||
fs.stat(JS_DIR + filename, function (error, stats) {
|
fs.stat(JS_DIR + filename, function (error, stats) {
|
||||||
if (error) {
|
if (error) {
|
||||||
if (error.code == "ENOENT") {
|
if (error.code == "ENOENT") {
|
||||||
|
@ -242,7 +246,8 @@ function fileExists(filename, callback) {
|
||||||
} else {
|
} else {
|
||||||
callback(undefined, stats.isFile());
|
callback(undefined, stats.isFile());
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function tarCode(jsFiles, write, callback) {
|
function tarCode(jsFiles, write, callback) {
|
||||||
|
|
Loading…
Reference in New Issue