minttoothpick
minttoothpick

Reputation: 85

Having trouble converting this Jade to EJS

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.

Upvotes: 0

Views: 1086

Answers (1)

glortho
glortho

Reputation: 13198

!{var} is unescaped interpolation in jade. You should be able to get the same thing in ejs by doing:

<%- includeJShare() %>

This should write in a <script> 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.

Upvotes: 1

Related Questions