Skip to content

Standalone build of Monkberry for use in browsers.

Notifications You must be signed in to change notification settings

monkberry/standalone

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monkberry Standalone

Standalone build of Monkberry for use in browsers.

CDN

https://cdn.jsdelivr.net/npm/monkberry-standalone@latest/monkberry.min.js

other versions on jsDelivr

Usage

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);

About

Standalone build of Monkberry for use in browsers.

Resources

Stars

Watchers

Forks

Packages

No packages published