Technology moves fast! ⚡ Don't get left behind.🚶 Subscribe to our mailing list to keep up with latest and greatest in open source projects! 🏆


Subscribe to our mailing list

ejs

a koa view render middleware, support all feature of ejs

Subscribe to updates I use ejs


Statistics on ejs

Number of watchers on Github 146
Number of open issues 1
Average time to close an issue 17 days
Main language JavaScript
Average time to merge a PR about 7 hours
Open pull requests 2+
Closed pull requests 7+
Last commit over 1 year ago
Repo Created over 5 years ago
Repo Last Updated over 1 year ago
Size 51 KB
Organization / Authorkoajs
Contributors11
Page Updated
Do you use ejs? Leave a review!
View ejs activity
View on github
Fresh, new opensource launches 🚀🚀🚀
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating ejs for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

koa-ejs

Build Status

Koa ejs view render middleware. support all feature of ejs.

NPM

Usage

Example

const Koa = require('koa');
const render = require('koa-ejs');
const path = require('path');

const app = new Koa();
render(app, {
  root: path.join(__dirname, 'view'),
  layout: 'template',
  viewExt: 'html',
  cache: false,
  debug: true
});

app.use(async function (ctx) {
  await ctx.render('user');
});

app.listen(7001);

Or you can checkout the example.

settings

  • root: view root directory.
  • layout: global layout file, default is layout, set false to disable layout.
  • viewExt: view file extension (default html).
  • cache: cache compiled templates (default true).
  • debug: debug flag (default false).
  • delimiter: character to use with angle brackets for open / close (default %).

Layouts

koa-ejs supports layouts. The default layout file is layout. If you want to change default layout file, use settings.layout. Also you can specify layout by options.layout in await ctx.render. Also you can set layout = false to disable the layout.

<html>
  <head>
    <title>koa ejs</title>
  </head>
  <body>
    <h3>koa ejs</h3>
    <%- body %>
  </body>
</html>

Include

Supports ejs includes.

<div>
  <% include user.html %>
</div>

State

Support ctx.state in koa.

Licences

(The MIT License)

Copyright (c) 2017 dead-horse and other contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

ejs open issues Ask a question     (View All Issues)
  • almost 3 years "locals" is not working
  • over 3 years doctype html bug
  • about 4 years Ejs 2.0
ejs open pull requests (View All Pulls)
  • add locals to render context
  • Fix path undefined in readme example.
ejs questions on Stackoverflow (View All Questions)
  • The correct way of accessing user data within page rendering in EJS
  • Node/Express/EJS/Mongoose: rendering when passing object to client?
  • ejs multiple class names
  • what can this ejs be look like in jade?
  • How to use server side functions/config in ejs template?
  • how can use two-way live binding in EJS (CanJS)
  • How to get value from .ejs to javascript file
  • EJS - convert new lines to <br/> and keep the content encoded
  • How to do data binding with ejs-locals in client side like AngularJS
  • how to display base64encoded image in ejs?
  • Image is not shown from mongodb in ejs template
  • How to display addListener data in a EJS template?
  • Sending Query Results from MySQL to .ejs
  • Sending data from js to html with ejs components
  • Emmet and EJS for atom not working
  • Node.js: SyntaxError: Unexpected token : while compiling ejs
  • Node.js, Express, EJS - refresh variable to output on page
  • how to show dynamic data in js script on ejs file?
  • EJS extract value then compare it to a string that is not undefined
  • sailsjs generate dynamic views/ejs files
  • how to get the value in the variable in the loop from ejs
  • Displaying mongoose objects on ejs page
  • How do i access ejs data in a form while using express
  • unexpected token ) while compiling ejs
  • Prevent empty lines in ejs for loops
  • Can I use conditional statements with EJS templates (in JMVC)?
  • Convert EJS to Jade?
  • How to make /user/:someone like url in ejs template with express?
  • .ejs when compared to .html?
  • Javascript references from EJS file not working on Webstorm
ejs list of languages used
Other projects in JavaScript