Evan Levesque
Evan Levesque

Reputation: 3213

Change Handlebars notations

I have two teams working on the same project , both are using template engines ( Client and Server Side Engines ) with the same notations "{{X}}" but with different contexts .
now what I want to do is to change the Handlebars notations from {{ }} into something else for example <% %>

I want to use this notation for example :

    <div><%X%></div>

instead of :

    <div>{{X}}</div>

some edits needs to be done on the Handlebars.js , but I can't find it.
how can I do that ?

knowing that I can do it with Mustache by changing the line

exports.tags = ["{{", "}}"];

to

exports.tags = ["<%", "%>"];

Upvotes: 0

Views: 150

Answers (2)

Gwendal Rou&#233;
Gwendal Rou&#233;

Reputation: 4044

Handlebars is defined with a formal grammar. You need to change https://github.com/wycats/handlebars.js/blob/master/src/handlebars.l

Upvotes: 0

Zorayr
Zorayr

Reputation: 24962

You should really think twice before proceeding with this approach. Modifying Handlebars.js and adding customized features is going to introduce several management issues that could possibly present a much higher cost at a later stages of the project. Consider these points:

  1. If you modify the current version, it will be either very hard or time-consuming to keep up with future updates of the tool.
  2. Current documentation and tutorials about the tool becomes obsolete or hard to follow.
  3. Any new developers added to the project will need to adjust to the changes and try to understand the new features of the tool.

Given these points, I would suggest to follow the standards and best-practices provided by each third party tool.

Hope this helps, and good luck!

Upvotes: 1

Related Questions