EJS include functions defined in a separate ejs file

Viewed 3033

I am trying to include an ejs file that contains functions for setting up my views. These functions were defined to be used a helpers. I have tried using:

<% include helpers.ejs %>

But when I try to use the function from this file:

<% module_start('$body', [{name:'display',value:'block'}], 'body'); %>

I get the error:

Reference Error: module_start is not defined

When I copy over the code from 'helpers.ejs' to my original view file, 'test.ejs', it works as expected. I have gone through several answers and, am still confused what am I doing wrongly in this case.

Thanks for your help in advance.

1 Answers
Related