
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
express-ejs-extend
Advanced tools
Layouts support for EJS templates in Express 3+.
First, add it as engine in your app:
// server.js
var express = require('express'),
path = require('path');
var app = express();
app.engine('ejs', require('express-ejs-extend')); // add this line
app.set('view engine', 'ejs');
app.set('views', path.join(__dirname, 'views'));
app.get('/', function (req, res) {
res.render('index', {title: 'world!'});
});
app.listen(3000);
Finally, in your views, call the extend function:
<%# views/index.ejs %>
<% extend('layout') %>
<h1>Hello <%= title %></h1>
<%# views/layout.ejs %>
<!DOCTYPE html>
<html>
<body>
<%- content %>
</body>
</html>
That's all, your GET / will render:
<!DOCTYPE html>
<html>
<body>
<h1>Hello world!</h1>
</body>
</html>
extend), you can surround the extend with
any combination of (<% or <%-) and (%> or -%>).<%- content %> so the
engine doesn't escape your HTML tags. Also you can end it with -%> instead
to avoid any trailing \n.extend is: extend(layout[, data]), so you can also pass
an object with data and that will be passed to the layout.This project is released under the MIT license.
FAQs
Layouts support for EJS templates in Express 3+.
The npm package express-ejs-extend receives a total of 109 weekly downloads. As such, express-ejs-extend popularity was classified as not popular.
We found that express-ejs-extend demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.