This package has been deprecated

Author message:

Strapi V3 is no longer maintained

strapi-hook-ejs

3.6.11 • Public • Published

strapi-hook-ejs

npm version npm downloads npm dependencies Build status Slack status

This built-in hook allows you to use the EJS template engine with custom options.


Deprecation Warning ⚠️

Hello, we've some news to share!

We released Strapi V4 in Q4 2021 and Strapi V3 will reach end-of-support around the end of Q3 2022.

Since this package won't be ported in V4, we took the decision to deprecate it.

If you’ve contributed to the development of this package, thank you again for that! We hope to see you on the V4 soon.

The Strapi team


Configuration

To configure your hook with custom options, you need to edit your ./config/hook.json file in your Strapi app.

{
  ...
  "ejs": {
    "enabled": true,
    "layout": "layout",
    "viewExt": "ejs",
    "partial": true,
    "cache": false,
    "debug": true
  }
}

More information in the Koa ejs module https://github.com/koajs/ejs#settings

Usage

Insert code in your controller to render a view.

module.exports = {
  home: async ctx => {
    return ctx.render('home', {
      title: 'My app title',
    });
  },
};

This will render the views/home.ejs file and you will have access to <%= title %> data in your ejs file.

Resources

Links

Readme

Keywords

Package Sidebar

Install

npm i strapi-hook-ejs

Homepage

strapi.io

Weekly Downloads

186

Version

3.6.11

License

SEE LICENSE IN LICENSE

Unpacked Size

5.2 kB

Total Files

4

Last publish

Collaborators

  • alexandrebodin
  • aurelsicoko
  • pierreburgy
  • lauriejim