You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letdata={}letstr="<%= include('./src/main/resources/ejs_templates/imports/imports.ejs');%>";varfn=ejs.compile(str,{client:true});varrendered=fn(data,null,function(path,d){// include callback logicvarincludedTemplate=fileReader.test3(path);print(includedTemplate)returnincludedTemplate;},null);
The problem very likely lies with the ejs tags you are using. This is actually one of the things mentioned in the documentation. The correct use of include requires the raw output tag <%-, or else the HTML might double escape.
EDIT: ok I also just saw that they have it in the docs like so
letstr="Hello <%= include('file', {person: 'John'}); %>",fn=ejs.compile(str,{client: true});fn(data,null,function(path,d){// include callback// path -> 'file'// d -> {person: 'John'}// Put your code here// Return the contents of file as a string});// returns rendered string
but I guess it's dependent on what is inside the included file, <%- for html and '<%=' for just ejs files? Absolutely not sure on this, needs some testing.
imports.ejs
output is:
The text was updated successfully, but these errors were encountered: