1
0
mirror of https://github.com/S2-/ejs-render-remote synced 2025-08-02 20:50:04 +02:00

6 Commits

Author SHA1 Message Date
s2
47459bd322 1.0.9 2020-02-07 20:50:08 +01:00
s2
6ed2b48d36 log async ejs compile error to console 2020-02-07 20:50:01 +01:00
s2
23d46035e8 1.0.8 2020-02-07 17:29:59 +01:00
s2
1c720ce9f3 when compile throws an exception, log it to the console 2020-02-07 17:26:54 +01:00
s2
8c9f23ce3f v1.0.7 2019-05-18 15:30:59 +02:00
s2
94d5afe1a0 resolve with templateUrl even when we have it already in cache 2019-05-18 15:30:59 +02:00
3 changed files with 24 additions and 10 deletions

View File

@@ -40,11 +40,15 @@
getTemplateFn.then(function(template) {
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
$('#' + r).replaceWith(ejs.render(
template,
data,
templateOptions
));
try {
$('#' + r).replaceWith(ejs.render(
template,
data,
templateOptions
));
} catch(ex) {
console.error(templateUrl, ex);
}
//clean up the getFnFor
if (ejs.cache.remove && ejs.cache.get('getFnFor' + templateUrl)) {
@@ -61,12 +65,18 @@
//if the template is already cached, just return.
if (ejs.cache.get(templateUrl)) {
d.resolve();
d.resolve(templateUrl);
} else {
$.get(templateUrl)
.then(function(template) {
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
var templateFn = ejs.compile(template, templateOptions);
try {
var templateFn = ejs.compile(template, templateOptions);
} catch(ex) {
console.error(templateUrl, ex);
d.reject(ex);
throw ex;
}
ejs.cache.set(templateUrl, templateFn);
d.resolve(templateUrl);

View File

@@ -1 +1 @@
Hello <%= name%>!
Hello <%= name %>!

View File

@@ -1,6 +1,6 @@
{
"name": "ejs-render-remote",
"version": "1.0.6",
"version": "1.0.9",
"description": "",
"main": "index.js",
"homepage": "https://github.com/S2-/ejs-render-remote",
@@ -9,5 +9,9 @@
},
"author": "s2 <s2@31337.it>",
"license": "ISC",
"keywords": ["ejs", "templating", "client-side"]
"keywords": [
"ejs",
"templating",
"client-side"
]
}