You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
s2 8c9f23ce3f v1.0.7 8 months ago
examples initial commit 9 months ago
.editorconfig some boilerplate stuff 9 months ago
.eslintignore some boilerplate stuff 9 months ago
.eslintrc.json some boilerplate stuff 9 months ago add an example 9 months ago
ejs-render-remote.js resolve with templateUrl even when we have it already in cache 8 months ago
package.json v1.0.7 8 months ago


ejs remote client side includes.

html = ejs.rr('sayhello.ejs', {name: 'Simon'});

Quick start

  1. Install with npm i ejs-render-remote
  2. Include this script html <script src="node_modules/ejs-render-remote/ejs-render-remote.js"></script>
  3. Create a file with your template, for example templates/hello-world.ejs containing hello <%= name %>!
  4. Render the remote template: js someDomelement.outerHTML = ejs.rr('templates/hello-world.ejs', {name: 'Simon'});


See examples folder.


ejs.rr(templateUrl, data)

ejs.rr (render remote) renders the remote template. It makes an ajax call to fetch the template and then ejs.renders it.
The resulting ejs template function is cached, so the second time this function is invoked for that same template, ejs.rr returns the rendered template synchronously.


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.