strapi/packages/strapi-hook-ejs
Peter Etelej 318f20e826
Bump up minimum required Node to 10.16 (#7962)
Updated README docs & package.json `engine` versions to bump up the
minimum required Node version from `10.10` to `10.16` (or `10.16.0+`)

Strapi no longer supports `10.10` since it updated `sharp` to `0.26.0`
( https://github.com/strapi/strapi/pull/7729 ) which requires Node 10.16.0+
(See https://github.com/lovell/sharp/blob/master/docs/changelog.md#v0260---25th-august-2020 )

` yarn create strapi-app my-project --quickstart` on 10.10 fails with error
```
error sharp@0.26.0: The engine "node" is incompatible with this module. Expected version ">=10.16.0". Got "10.10.0"
error Found incompatible module.
```

Signed-off-by: Peter Etelej <peter@etelej.com>
2020-09-22 16:00:13 +02:00
..
2019-10-01 17:56:52 +02:00
2019-04-16 09:05:47 +02:00
2018-12-05 15:42:58 +01:00
2020-07-08 09:45:28 +02:00
2020-07-20 18:40:52 +02:00

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