3.12.9 • Published 10 months ago

@toanz/strapi-hook-ejs v3.12.9

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
10 months ago

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.

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

3.12.9

10 months ago

3.12.8

10 months ago

3.12.7

10 months ago