Strategy for AngularJS

104 views
Skip to first unread message

James Moger

unread,
Sep 17, 2014, 10:22:41 AM9/17/14
to pebble-templ...@googlegroups.com
Nice engine.

I'm playing around with it and I am wondering how Pebble handles AngularJS since both make use of the handlebars/mustache syntax {{ }}.

Some Mustache engines allow you to change the {{ }} delimiter.
Others add a helper/extension like {{ng ng-stuff-here }}.

-J

Mitchell Bösecke

unread,
Sep 17, 2014, 2:45:03 PM9/17/14
to
Hi James,

In theory, Pebble will allow you to customize the delimiters. It will look something like the following:

// construct the engine
PebbleEngine engine = new PebbleEngine();

// pull out the lexer and change the delimiters
Lexer lexer = engine.getLexer();
lexer
.setPrintOpenDelimiter("<<");
lexer
.setPrintCloseDelimiter(">>");

// compile the template
PebbleTemplate template = engine.getTemplate("templates/home.html");

// render the template
Writer writer = new StringWriter();
template.evaluate(writer);


However, I must admit that it is currently untested. I'm sure I tested it at least once during initial development but currently there isn't any unit test coverage for this feature. If you get a chance to try it out, let me know how it goes. Hopefully I'll get a chance to add some test coverage for this soon.

Andrew Grothe

unread,
Jul 19, 2017, 9:18:27 PM7/19/17
to Pebble Templating Engine
In case someone else finds this via google like I did, the proper way to do this now is found here: https://github.com/PebbleTemplates/pebble/issues/259

Reply all
Reply to author
Forward
0 new messages