update packages

This commit is contained in:
s2
2019-04-14 21:57:21 +02:00
parent dde32ded55
commit 52bea6d10d
8 changed files with 76 additions and 24 deletions

View File

@@ -2,6 +2,10 @@
[ejs](https://ejs.co/) remote client side includes.
```js
html = ejs.rr('sayhello.ejs', {name: 'Simon'});
```
## Quick start
0. Install with `npm i ejs-render-remote`
@@ -9,7 +13,7 @@
```html
<script src="node_modules/ejs-render-remote/ejs-render-remote.js"></script>
```
2. Creare a file with your template, for example `templates/hello-world.ejs` containing `hello <%= name %>!`
2. Create a file with your template, for example `templates/hello-world.ejs` containing `hello <%= name %>!`
3. Render the remote template:
```js
someDomelement.outerHTML = ejs.rr('templates/hello-world.ejs', {name: 'Simon'});
@@ -28,5 +32,5 @@ The resulting ejs template function is cached, so the second time this function
### ejs.preloadTemplate(templateUrl)
Since `ejs.rr` is async, you can call `ejs.preloadTemplate` before invoking `ejs.rr` to warm the template chace up for that `templateUrl`.
Since `ejs.rr` is async, you can call `ejs.preloadTemplate` before invoking `ejs.rr` to warm the template cache up for that `templateUrl`.
By doing so the call to `ejs.rr` will return the rendered template string right away.