Merge branch 'master' into rte-rework

This commit is contained in:
Kim Gardner
2018-03-21 16:42:54 -04:00
committed by GitHub
2 changed files with 6 additions and 6 deletions
+1 -1
View File
@@ -104,6 +104,7 @@
"exports-loader": "^0.6.4",
"express": "4.16.0",
"express-static-gzip": "^0.3.1",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^0.11.2",
"form-data": "^2.3.1",
"fs-extra": "^4.0.1",
@@ -213,7 +214,6 @@
"enzyme-adapter-react-15": "^1.0.0",
"eslint": "^4.5.0",
"eslint-plugin-mocha": "^4.11.0",
"extract-text-webpack-plugin": "^3.0.2",
"husky": "^0.14.3",
"identity-obj-proxy": "^3.0.0",
"ip": "^1.1.5",
+5 -5
View File
@@ -1,5 +1,5 @@
const path = require('path');
const fs = require('fs-extra');
const fs = require('fs');
const { get, set, template } = require('lodash');
// load all the templates as strings
@@ -9,20 +9,20 @@ const templates = {
};
// Registers a template with the given filename and format.
templates.register = async (filename, name, format) => {
templates.register = (filename, name, format) => {
// Check to see if this template was already registered.
if (get(templates.registered, [name, format], null) !== null) {
return;
}
const file = await fs.readFile(filename, 'utf8');
const file = fs.readFileSync(filename, 'utf8');
const view = template(file);
set(templates.registered, [name, format], view);
};
// load the templates per request during development
templates.render = async (name, format = 'txt', context) => {
templates.render = (name, format = 'txt', context) => {
// Check to see if the template is a registered template (provided by a plugin
// ) and prefer that first.
let view = get(templates.registered, [name, format], null);
@@ -44,7 +44,7 @@ templates.render = async (name, format = 'txt', context) => {
'templates',
[name, format, 'ejs'].join('.')
);
const file = await fs.readFile(filename, 'utf8');
const file = fs.readFileSync(filename, 'utf8');
view = template(file);
if (process.env.NODE_ENV === 'production') {