Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ejs-render-remote

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ejs-render-remote

[ejs](https://ejs.co/) remote client side includes.

  • 1.0.13
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
1
Weekly downloads
 
Created
Source

ejs-render-remote

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
    <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:
    someDomelement.outerHTML = ejs.rr('templates/hello-world.ejs', {name: 'Simon'});
    

Examples

See examples folder.

api

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.

ejs.preloadTemplate(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.

Keywords

FAQs

Package last updated on 12 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc