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

4 Commits

Author SHA1 Message Date
s2
37a2512f4b v1.0.3 2019-04-14 22:05:08 +02:00
s2
326e760c78 resolve with the templateUrl on preload 2019-04-14 22:04:52 +02:00
s2
95a1708280 v1.0.2 2019-04-14 21:55:06 +02:00
s2
c4fc133475 outerHTML vs replaceWith 2019-04-14 21:54:34 +02:00
2 changed files with 9 additions and 9 deletions

View File

@@ -33,14 +33,14 @@
var r = uuidv4(); var r = uuidv4();
getTemplateFn.then(function(template) { getTemplateFn.then(function(template) {
document.getElementById(r).outerHTML = ejs.render( $('#' + r).replaceWith(ejs.render(
template, template,
data, data,
{ {
cache: true, cache: true,
filename: templateUrl filename: templateUrl
} }
); ));
}); });
return '<span class="ejs-templateplaceholder" style="display: none;" id="' + r + '"></span>'; return '<span class="ejs-templateplaceholder" style="display: none;" id="' + r + '"></span>';
@@ -57,17 +57,17 @@
$.get(templateUrl) $.get(templateUrl)
.then(function(template) { .then(function(template) {
var templateFn = ejs.compile(template, var templateFn = ejs.compile(template,
{ {
cache: true, cache: true,
filename: templateUrl filename: templateUrl
}); });
ejs.cache.set(templateUrl, templateFn); ejs.cache.set(templateUrl, templateFn);
d.resolve(); d.resolve(templateUrl);
}); });
} }
return d; return d;
} };
})(jQuery); })(jQuery);

View File

@@ -1,6 +1,6 @@
{ {
"name": "ejs-render-remote", "name": "ejs-render-remote",
"version": "1.0.1", "version": "1.0.3",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"homepage": "https://github.com/S2-/ejs-render-remote", "homepage": "https://github.com/S2-/ejs-render-remote",