Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Handlebars util methods in Meteor server

I'm working on my first Meteor app, and I'm trying to escape a string on the server side. I was hoping to use Handlebars.Utils.escapeExpression, but even when I add handlebars (which I had to do, even though Meteor already uses it?), I still get

ReferenceError: Handlebars is not defined

error when that code is hit. Is there a way to invoke that method server side without manually including the source in my project?

like image 742
Chris Avatar asked Apr 10 '26 03:04

Chris


1 Answers

Meteor uses Handlebars on the client only. Server-side rendering is on the roadmap.

Also, the Handlebars that comes with Meteor doesn't include Utils.

Use {{{thingThatNeedsEscaping}}} instead, as per the documentation that unescapes it.

Also, I don't think it's necessary to escape stuff before inserting it into the database, if you want it though there are other JS functions for that (like escape variants that are not deprecated).

like image 199
Tamara Wijsman Avatar answered Apr 13 '26 23:04

Tamara Wijsman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!