Skip to content

v4.4.0

Compare
Choose a tag to compare
@miripiruni miripiruni released this 03 Aug 16:35
· 628 commits to master since this release

New option production. When it set to true bem-xjst will render bemjson even
if one template contains error.

Example:

var template = bemxjst.compile(function() {
  block('b1').attrs()(function() {
    var attrs = applyNext();
    attrs.undef.foo = 'bar';
    return attrs;
  });
}, { production: true });
var html = template.apply({ block: 'page', content: { block: 'b1' } });

html will equals <div class="page"></div>.

Also in production mode bem-xjst will produce error messages to STDERR.

$node index.js 1> stdout.txt 2> stderr.txt

$ cat stdout.txt
<div class="page"></div>

$ cat stderr.txt
BEMXJST ERROR: cannot render block b1, elem undefined, mods {}, elemMods {} [TypeError: Cannot read property 'undef' of undefined]

Commits:

  • [8b3369f270] - Merge pull request #299 from bem/trycatch-for-4.x (Slava Oliyanchuk)