mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(template) add: read all templates on start
This commit is contained in:
parent
29ac0677af
commit
671101d201
2 changed files with 32 additions and 50 deletions
28
server/template.js
Normal file
28
server/template.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
const join = require('path').join;
|
||||
|
||||
const DIR = __dirname + '/../';
|
||||
const DIR_TMPL = DIR + 'tmpl/';
|
||||
const DIR_FS = DIR_TMPL + 'fs/';
|
||||
|
||||
const TMPL_PATH = [
|
||||
'file',
|
||||
'panel',
|
||||
'path',
|
||||
'pathLink',
|
||||
'link',
|
||||
];
|
||||
|
||||
module.exports = () => {
|
||||
const templates = {};
|
||||
|
||||
TMPL_PATH.forEach((name) => {
|
||||
const path = join(DIR_FS, `${name}.hbs`);
|
||||
templates[name] = fs.readFileSync(path, 'utf8');
|
||||
});
|
||||
|
||||
return templates;
|
||||
};
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue