I have part of code stored in db as a string. So that would be
var code = "<% if ('undefined' === typeof(store.disable_sharesale_upsellit) || store.disable_sharesale_upsellit == false) { %>
<% if (typeof(store.settings.shareasale_id) != 'undefined' && '' != store.settings.shareasale_id && typeof(store.settings.allpages_upsellit_snippet_pixel) != 'undefined' && store.settings.allpages_upsellit_snippet_pixel != '') { %>
<script>
var shareasale_id = <%- JSON.stringify(store.settings.shareasale_id) %>;
console.log(shareasale_id);
console.log('shareasale123');
</script>
<% } %>
<% if (typeof(store.settings.upsellit_id) != 'undefined' && '' != store.settings.upsellit_id && typeof(store.settings.allpages_upsellit_snippet_pixel) != 'undefined' && store.settings.allpages_upsellit_snippet_pixel != '') { %>
<script type="text/javascript">
console.log('upsellit');
</script>
<% } %>
<% } %>"
Now im passing this variable thru res.view as setting and in the ejs file im trying to pass it like this:
<%- store.settings.code %>
but what im getting is that js console.logs are executed but ejs tags are shown on page as they are in paragraph. Also the console log where ejs tags are present throws error. Not doing the if checkings as it does when the code is written directly in the ejs file. Any hint how to pass ejs code stored as string in the ejs file?