mirror of
https://github.com/S2-/ejs-render-remote
synced 2025-08-04 13:20:06 +02:00
Compare commits
4 Commits
v1.0.0
...
39238a44d6
Author | SHA1 | Date | |
---|---|---|---|
39238a44d6 | |||
b8c9b8d180 | |||
12db14bdb8 | |||
1284a11acb |
@@ -4,11 +4,12 @@
|
|||||||
|
|
||||||
## Quick start
|
## Quick start
|
||||||
|
|
||||||
|
0. Install with `npm i ejs-render-remote`
|
||||||
1. Include this script
|
1. Include this script
|
||||||
```html
|
```html
|
||||||
<script src="node_modulse/ejs-render-remote/ejs-render-remote.js"></script>
|
<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:
|
3. Render the remote template:
|
||||||
```js
|
```js
|
||||||
someDomelement.outerHTML = ejs.rr('templates/hello-world.ejs', {name: 'Simon'});
|
someDomelement.outerHTML = ejs.rr('templates/hello-world.ejs', {name: 'Simon'});
|
||||||
@@ -27,5 +28,5 @@ The resulting ejs template function is cached, so the second time this function
|
|||||||
|
|
||||||
### ejs.preloadTemplate(templateUrl)
|
### 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.
|
By doing so the call to `ejs.rr` will return the rendered template string right away.
|
||||||
|
@@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "ejs-render-remote",
|
"name": "ejs-render-remote",
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
|
"homepage": "https://github.com/S2-/ejs-render-remote",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
},
|
},
|
||||||
"author": "",
|
"author": "s2 <s2@31337.it>",
|
||||||
"license": "ISC"
|
"license": "ISC",
|
||||||
|
"keywords": ["ejs", "templating", "client-side"]
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user