feature(html) html -> tmpl: 2 x times speed up

This commit is contained in:
coderaiser 2015-06-10 12:28:02 -04:00
parent c9bbf0cf2b
commit d533a4259d
14 changed files with 9 additions and 8 deletions

View file

@ -18,7 +18,7 @@
FILES_HTML = 'file|path|link|pathLink|media', FILES_HTML = 'file|path|link|pathLink|media',
FILES_HTML_ROOT = 'view/media-tmpl|config-tmpl|upload', FILES_HTML_ROOT = 'view/media-tmpl|config-tmpl|upload',
funcs = [], funcs = [],
DIR_HTML = '/html/', DIR_HTML = '/tmpl/',
DIR_HTML_FS = DIR_HTML + 'fs/', DIR_HTML_FS = DIR_HTML + 'fs/',
DIR_JSON = '/json/'; DIR_JSON = '/json/';
@ -78,7 +78,7 @@
else else
path = DIR_HTML_FS + name; path = DIR_HTML_FS + name;
path += '.html'; path += '.hbs';
} else if (isJSON) { } else if (isJSON) {
path = DIR_JSON + name + '.json'; path = DIR_JSON + name + '.json';
} }

View file

@ -2,7 +2,7 @@
'use strict'; 'use strict';
var DIR = __dirname + '/../../', var DIR = __dirname + '/../../',
DIR_HTML = DIR + 'html/', DIR_HTML = DIR + 'tmpl/',
DIR_LIB = DIR + 'lib/', DIR_LIB = DIR + 'lib/',
DIR_SERVER = __dirname + '/', DIR_SERVER = __dirname + '/',
DIR_FS = DIR_HTML + 'fs/', DIR_FS = DIR_HTML + 'fs/',
@ -23,7 +23,7 @@
CloudFunc = require(DIR_LIB + 'cloudfunc'), CloudFunc = require(DIR_LIB + 'cloudfunc'),
PATH_INDEX = DIR_FS + 'index.html', PATH_INDEX = DIR_FS + 'index.hbs',
TMPL_PATH = [ TMPL_PATH = [
'file', 'file',
@ -97,7 +97,7 @@
callback(); callback();
} else { } else {
filesList = TMPL_PATH.map(function(name) { filesList = TMPL_PATH.map(function(name) {
var path = DIR_FS + name + '.html'; var path = DIR_FS + name + '.hbs';
paths[path] = name; paths[path] = name;
@ -143,9 +143,10 @@
request : request, request : request,
response : response, response : response,
gzip : true, gzip : true,
name : name name : name,
mime : 'text/html'
}; };
console.log(p.mime, '...')
if (!isAuth && !isFS) if (!isAuth && !isFS)
callback(); callback();
else if (isAuth) { else if (isAuth) {
@ -164,7 +165,7 @@
if (!error) if (!error)
buildIndex(dir, function(error, data) { buildIndex(dir, function(error, data) {
p.name = PATH_INDEX; p.name = PATH_INDEX;
console.log(p, '88888')
if (error) if (error)
ponse.sendError(error, p); ponse.sendError(error, p);
else else