Standalone build of Monkberry for use in browsers.
https://cdn.jsdelivr.net/npm/monkberry-standalone@latest/monkberry.min.js
Include it to your page.
<script src="https://cdn.jsdelivr.net/npm/monkberry-standalone@latest/monkberry.min.js"></script>
Define template with text/monkberry
.
<script type="text/monkberry" id="component">
<h1>
Hello, {{ name }}!
</h1>
</script>
And you now can get access to component
template.
var view = Monkberry.render(component, document.body);
Mark node with data-monkberry
attribule and it will be replaced with real view of Monkberry.
<div data-monkberry="app">
<component name="world"></component>
<p>This is {{ name || 'noname' }}.</p>
</div>
To get view instanse call Monkberry.getView
method.
var view = Monkberry.getView('app');
view.update({name: 'Anton'});
Also with monkberry-standalone you can compile source code to JavaScript code.
var code = '<div>{{ text }}</div>';
var source = Monkberry.compile('name', code);