use directories for structure

This commit is contained in:
s2
2020-05-26 10:37:57 +02:00
parent 66580d4847
commit ae4aaf2668
1287 changed files with 92093 additions and 13113 deletions

View File

@@ -28,6 +28,7 @@
"dot-notation": 0,
"no-multi-str": 2,
"key-spacing": [2, {"afterColon": true}],
"func-call-spacing": [2, "never"]
"func-call-spacing": [2, "never"],
"no-console": "warn"
}
}

View File

@@ -37,14 +37,18 @@
}
var r = uuidv4();
getTemplateFn.then(function(template) {
getTemplateFn.done(function(template) {
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
$('#' + r).replaceWith(ejs.render(
template,
data,
templateOptions
));
try {
$('#' + r).replaceWith(ejs.render(
template,
data,
templateOptions
));
} catch(ex) {
$.readyException(ex);
}
//clean up the getFnFor
if (ejs.cache.remove && ejs.cache.get('getFnFor' + templateUrl)) {
@@ -64,12 +68,16 @@
d.resolve(templateUrl);
} else {
$.get(templateUrl)
.then(function(template) {
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
var templateFn = ejs.compile(template, templateOptions);
ejs.cache.set(templateUrl, templateFn);
d.resolve(templateUrl);
.done(function(template) {
try {
var templateOptions = overwriteWithCacheOptions(options, templateUrl);
var templateFn = ejs.compile(template, templateOptions);
ejs.cache.set(templateUrl, templateFn);
d.resolve(templateUrl);
} catch(ex) {
$.readyException(ex);
d.reject(ex);
}
});
}

File diff suppressed because one or more lines are too long

View File

@@ -9,6 +9,7 @@
<body>
<h1>ejs-render-remote example</h1>
<p class="hello"></p>
<div class="sometext"></div>
<script src="jquery.min.js"></script>
<script src="ejs.min.js"></script>
@@ -18,6 +19,14 @@
<script>
//render the template
$('.hello').html(ejs.rr('templates/hello.ejs', {name: 'Simon'}));
//a more elaborate example: preload the template to be sure the dom is
//ready when manipulated
ejs.preloadTemplate('templates/somestuff.ejs')
.then(function(t) {
$('.sometext').html(ejs.rr(t)); //this is sync now
$('.stuff').html('hi!');
});
</script>
</body>
</html>

View File

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

View File

@@ -0,0 +1 @@
<p class="stuff"></p>

View File

@@ -1,28 +1,28 @@
{
"_from": "ejs-render-remote@1.0.7",
"_id": "ejs-render-remote@1.0.7",
"_from": "ejs-render-remote@1.0.13",
"_id": "ejs-render-remote@1.0.13",
"_inBundle": false,
"_integrity": "sha512-Yr3dk+Z1tn386sntXBZv53Ql0s+vg7clKFP6URGsZvKkPr5nyc9oJ/tAZBcodHh3y9js1u+Z4DvW7wm622HjTA==",
"_integrity": "sha512-i7wHh2ofonx0+lZTrWxaY0jvXVh+Q240YHV/0zdbWQ3fzeiWJrRTK4ubRb07h5ovbn2O9VGnEmweoG78xN1Xaw==",
"_location": "/ejs-render-remote",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "ejs-render-remote@1.0.7",
"raw": "ejs-render-remote@1.0.13",
"name": "ejs-render-remote",
"escapedName": "ejs-render-remote",
"rawSpec": "1.0.7",
"rawSpec": "1.0.13",
"saveSpec": null,
"fetchSpec": "1.0.7"
"fetchSpec": "1.0.13"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/ejs-render-remote/-/ejs-render-remote-1.0.7.tgz",
"_shasum": "d741834afc9418d0b0a9eec3af8dafe014d8ff18",
"_spec": "ejs-render-remote@1.0.7",
"_where": "/home/s2/Code/vanillajs-seed",
"_resolved": "https://registry.npmjs.org/ejs-render-remote/-/ejs-render-remote-1.0.13.tgz",
"_shasum": "a8e10770e9c628ec2f66cbbf5315bddb33914622",
"_spec": "ejs-render-remote@1.0.13",
"_where": "D:\\Projects\\siag\\vanillajs-seed",
"author": {
"name": "s2",
"email": "s2@31337.it"
@@ -42,5 +42,5 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"version": "1.0.7"
"version": "1.0.13"
}