New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ejs-next

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ejs-next

EJS next gen

  • 1.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
22
increased by69.23%
Maintainers
1
Weekly downloads
 
Created
Source

ejs-next

Coverage Status

EJS next generation


Install

npm install ejs-next

Changes

  • Using async actions with promises (on files actions)
  • Improved performances on parser
  • Introduce a new JS tags for capturing outputs
  • Introduce new functions : layout & block

Syntax

The syntax is the same as classic EJS, with the introduction of a little new content wrapper :

  • {@ : start to capture output
  • @} : returns the captured output

Usage :

<html>
... <%- include('foo.ejs', {
      inner: function(name) => {@
        %>
          Hello <%= name %>
        <%
      @}
    }) %>
</html>
--- and foo.ejs :
<%= inner('John Smith'); %>

Layout

The layout will replace the output with the specified file, and put the current output into a contents variable.

<%_ layout('main') _%>
Here is my page content
--- main.ejs :
<body>
  <%- contents %>
</body>

Block

The block registers/concatenate the specified output in order to output it elsewhere. Note that by using promise actions the orders in which statements are called may not be preserved.

<%_ block('js', '<script src="...">') _%>
Here is my page content
--- main.ejs :
<body>
  <%- js %>
</body>

Express usage

var ejs = require("ejs-next");
app.set("views", path.join(__dirname, "views"));
app.engine("ejs", ejs.__express);
app.set("view engine", "ejs");

IDE Integration with Syntax Highlighting

VSCode:Javascript EJS by DigitalBrainstem

There are a number of implementations of EJS:

License

MIT License - Copyright (c) 2022 Ioan CHIRIAC

Keywords

FAQs

Package last updated on 21 Dec 2022

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