mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-04-28 19:29:15 -04:00
Removed some more minify stuff
This commit is contained in:
parent
6cbf8a6245
commit
2f12fc0229
1 changed files with 1 additions and 50 deletions
|
@ -241,47 +241,6 @@ function minify(req, res, next)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// find all includes in ace.js and embed them.
|
|
||||||
function getAceFile(callback) {
|
|
||||||
fs.readFile(ROOT_DIR + 'js/ace.js', "utf8", function(err, data) {
|
|
||||||
if(ERR(err, callback)) return;
|
|
||||||
|
|
||||||
// Find all includes in ace.js and embed them
|
|
||||||
var founds = data.match(/\$\$INCLUDE_[a-zA-Z_]+\("[^"]*"\)/gi);
|
|
||||||
if (!settings.minify) {
|
|
||||||
founds = [];
|
|
||||||
}
|
|
||||||
// Always include the require kernel.
|
|
||||||
founds.push('$$INCLUDE_JS("../static/js/require-kernel.js")');
|
|
||||||
|
|
||||||
data += ';\n';
|
|
||||||
data += 'Ace2Editor.EMBEDED = Ace2Editor.EMBEDED || {};\n';
|
|
||||||
|
|
||||||
// Request the contents of the included file on the server-side and write
|
|
||||||
// them into the file.
|
|
||||||
async.forEach(founds, function (item, callback) {
|
|
||||||
var filename = item.match(/"([^"]*)"/)[1];
|
|
||||||
|
|
||||||
var baseURI = 'http://localhost:' + settings.port;
|
|
||||||
var resourceURI = baseURI + path.normalize(path.join('/static/', filename));
|
|
||||||
resourceURI = resourceURI.replace(/\\/g, '/'); // Windows (safe generally?)
|
|
||||||
|
|
||||||
requestURI(resourceURI, 'GET', {}, function (status, headers, body) {
|
|
||||||
var error = !(status == 200 || status == 404);
|
|
||||||
if (!error) {
|
|
||||||
data += 'Ace2Editor.EMBEDED[' + JSON.stringify(filename) + '] = '
|
|
||||||
+ JSON.stringify(status == 200 ? body || '' : null) + ';\n';
|
|
||||||
} else {
|
|
||||||
// Silence?
|
|
||||||
}
|
|
||||||
callback();
|
|
||||||
});
|
|
||||||
}, function(error) {
|
|
||||||
callback(error, data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for the existance of the file and get the last modification date.
|
// Check for the existance of the file and get the last modification date.
|
||||||
function statFile(filename, callback, dirStatLimit) {
|
function statFile(filename, callback, dirStatLimit) {
|
||||||
if (typeof dirStatLimit === 'undefined') {
|
if (typeof dirStatLimit === 'undefined') {
|
||||||
|
@ -290,12 +249,6 @@ function statFile(filename, callback, dirStatLimit) {
|
||||||
|
|
||||||
if (dirStatLimit < 1 || filename == '' || filename == '/') {
|
if (dirStatLimit < 1 || filename == '' || filename == '/') {
|
||||||
callback(null, null, false);
|
callback(null, null, false);
|
||||||
} else if (filename == 'js/ace.js') {
|
|
||||||
// Sometimes static assets are inlined into this file, so we have to stat
|
|
||||||
// everything.
|
|
||||||
lastModifiedDateOfEverything(function (error, date) {
|
|
||||||
callback(error, date, !error);
|
|
||||||
});
|
|
||||||
} else if (filename == 'js/require-kernel.js') {
|
} else if (filename == 'js/require-kernel.js') {
|
||||||
callback(null, requireLastModified(), true);
|
callback(null, requireLastModified(), true);
|
||||||
} else {
|
} else {
|
||||||
|
@ -389,9 +342,7 @@ function getFileCompressed(filename, contentType, callback) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFile(filename, callback) {
|
function getFile(filename, callback) {
|
||||||
if (filename == 'js/ace.js') {
|
if (filename == 'js/require-kernel.js') {
|
||||||
getAceFile(callback);
|
|
||||||
} else if (filename == 'js/require-kernel.js') {
|
|
||||||
callback(undefined, requireDefinition());
|
callback(undefined, requireDefinition());
|
||||||
} else {
|
} else {
|
||||||
fs.readFile(ROOT_DIR + filename, callback);
|
fs.readFile(ROOT_DIR + filename, callback);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue