How to change the default delimiter of Handlebars.js?

前端 未结 8 1869
半阙折子戏
半阙折子戏 2020-12-10 02:41

I need to use handlebars.js and I also use Blade template engine from Laravel (PHP Framework). The tags {{}} conflict with blade\'s placeholders that are exactly the same.

8条回答
  •  感动是毒
    2020-12-10 02:57

    There is an option to tell template engine for not parsing certain part of code and treat it as plain text.

    Find the following ways to do it, hope it helps somebody.

    In blade template engine (laravel) you can use @verbatim Directive. So that you dont have to add @ to every variable. Example :

    @verbatim
        
    Hello, {{ name }}.
    @endverbatim

    Similarly for twig template engine (symfony) you can block the whole code by using

    {% verbatim %}
        
    My name is {{name}}. I am a {{occupation}}.
    {% endverbatim %}

提交回复
热议问题