file 1: ejsfunction.ejs
<% function funcTest() {return 42;} %>
file 2: file.ejs
<% include ejsfunction.ejs %>
<% funcTest(); %>
output:
ReferenceError:
1| <% include ejsfunction.ejs %>
>> 2| <% funcTest(); %>
funcTest is not defined
Hi, I am working on a node.js/express project and trying to refactor some functions out of an ejs file into a second file, and then use the include directive to load them back in. Unfortunately, I am doing something wrong as I keep getting a ReferenceError with the code above.
Can anybody tell me what I am doing wrong, please?
Many thanks in advance! Dan.