Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel 4 Blade {{}} and Hogan.js {{}} Syntax

I am using Laravel 4 with the Blade Templating Engine and Hogan.js.

By default my site thinks {{...}} is used by PHP and Laravel. Now I want to use Hogan.js and the syntax is {{...}} too. I am getting an error, because they use the same syntax here.

How can I use both?

like image 638
zer02 Avatar asked Dec 06 '13 20:12

zer02


1 Answers

You can prepend @ to your Hogan placeholders, and Laravel will ignore them.

// This will work only in JavaScript
@{{ JavaScript }}

// This will be rendered in blade
{{ $foo }}
like image 122
Manuel Pedrera Avatar answered Nov 17 '22 05:11

Manuel Pedrera