Having trouble converting this Jade to EJS
Problem
I am attempting to utilize the Jshare module for Node/Express.
The example given on Github says:
Next, you need to make a call out to the JShare helper method in your layout file:
!!!
html
head
title= title
link(rel='stylesheet', href='/stylesheets/style.css')
!{includeJShare()}
body!= body
So, this example is in Jade. I am using EJS, and for the life of me, I can't figure out how to implement the helper method... This seems so simple, but I'm not sure what !{} does in Jade, or how to replicate it in EJS.
Solution
!{var}
is unescaped interpolation in jade. You should be able to get the same thing in ejs by doing:
This should write in a tag.
Edit
If ejs tries to parse include
, submit a patch request to https://github.com/brooklynDev/JShare/issues (or to ejs) and in the meantime go into node_modules/JShare/jshare.js and change res.locals.includeJShare
to just res.locals.JShare
and then use JShare()
in your ejs.
Discussion
View additional discussion.