mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-08 23:15:48 +01:00
Precompile all templates
- Benchpress compilation is 33x faster now - Native module with JS fallback and pre-built binaries - Dev template build is <1sec now - Minified template build is ~5sec (uglify accounts for almost all)
This commit is contained in:
@@ -289,22 +289,26 @@ Emailer.sendViaFallback = function (data, callback) {
|
||||
function buildCustomTemplates(config) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
Emailer.getTemplates(config, next);
|
||||
async.parallel({
|
||||
templates: function (cb) {
|
||||
Emailer.getTemplates(config, cb);
|
||||
},
|
||||
paths: function (cb) {
|
||||
file.walk(viewsDir, cb);
|
||||
},
|
||||
}, next);
|
||||
},
|
||||
function (templates, next) {
|
||||
templates = templates.filter(function (template) {
|
||||
function (result, next) {
|
||||
var templates = result.templates.filter(function (template) {
|
||||
return template.isCustom && template.text !== prevConfig['email:custom:' + path];
|
||||
});
|
||||
var paths = _.fromPairs(result.paths.map(function (p) {
|
||||
var relative = path.relative(viewsDir, p).replace(/\\/g, '/');
|
||||
return [relative, p];
|
||||
}));
|
||||
async.each(templates, function (template, next) {
|
||||
async.waterfall([
|
||||
function (next) {
|
||||
file.walk(viewsDir, next);
|
||||
},
|
||||
function (paths, next) {
|
||||
paths = _.fromPairs(paths.map(function (p) {
|
||||
var relative = path.relative(viewsDir, p).replace(/\\/g, '/');
|
||||
return [relative, p];
|
||||
}));
|
||||
meta.templates.processImports(paths, template.path, template.text, next);
|
||||
},
|
||||
function (source, next) {
|
||||
|
||||
Reference in New Issue
Block a user