Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change start and end symbol in Jekyll, to avoid Angular conflict

Both Angular.JS and Jekyll use {{ and }} to mark beginning and end of an expression. So, if you're using both, there's a conflict and Jekyll will typically wipe out or mess with the Angular expressions.

One fix is to tell Angular to use different symbols via $interpolateProvider, for example:

var app = angular.module('app', [],
    function($interpolateProvider) {
        $interpolateProvider.startSymbol('[[{').endSymbol('}]]');
    });

Is there also a way to tell Jekyll to use different start and end symbols?

UPDATE: Why? Just trying to find a less invasive way to resolve the conflict, as my projects typically contain a lot more Angular markup than Jekyll markup.

like image 491
Max Avatar asked Aug 15 '14 21:08

Max


1 Answers

The double curly braces come from Liquid templating language. I think you cannot change it.

Not sure what exactly you are trying to do, but you might get away by using the raw tag. This tells liquid to ignore the code that is placed inside it and it won't try to interpret it:

{% raw %} 
{{ some angular code here }}
{% endraw %}
like image 137
Mitja Bezenšek Avatar answered Nov 06 '22 23:11

Mitja Bezenšek