monkberry

Monkberry is a JavaScript library for building web user interfaces

  • 所有者: antonmedv/monkberry
  • 平台:
  • 许可证: MIT License
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Monkberry

npm
Build Status

Monkberry is blazingly fast, small 1kb and simple JavaScript library for building web user interfaces.

Example

Monkberry comes with powerfull templating engine, which is compiled to JavaScript.

<ol>
  {% for todos %}
    <li>
      {% if complete %}
        <del>{{ text }}</del>
      {% else %}
        <em>{{ text }}</em>
      {% endif %}
    </li>
  {% endfor %}
</ol>

and then

import Monkberry from 'monkberry';
import Template from 'template.monk';

const view = Monkberry.render(Template, document.body);

view.update({todos: [...]});

Features

  • Small 1kb minified & gzipped
  • Simple, small learning curve
  • Fully tested
  • Precompiled templates
  • Source maps
  • Custom tags
  • Blazingly fast (only necessary dom updates)

Documentation

Documentation available on monkberry.js.org site.

Development

If you want to hack on Monkberry, the first step is to fork the repo.

# Build compiler
npm run build

# Build parser
npm run build:parser

# Watch changes and rebuild
npm run watch

# Start tests server
testem

Plugins

Performance

Benchmarks

Why is Monkberry so fast? Even in comparison with React, Monkberry is 10 times faster, sometimes 100 times faster.
It's because Monkberry will do only necessary dom updates, and does it in a completely different way than React does.
Monkberry compiles template to plain JavaScript to gain an advantage by using v8 hidden classes and reduce call stack.
There is no virtual dom (in general, an react app have to keep 3 virtual doms), for example next template will be generated to JavaScript code which will do only necessary dom updates on state changes.

<div>
  ...
    <h1>{{ title }}</h1>
  ...
</div>

Will be compiled to code like this:

function (state) {
  h1.textContent = state.title;
}

Benchmarks covers a few use cases and compares Monkberry with React and innerHTML. Also, it contains real site code and data.

License

The MIT License (MIT) Copyright © 2016 Medvedev Anton

主要指标

概览
名称与所有者antonmedv/monkberry
主编程语言JavaScript
编程语言JavaScript (语言数: 3)
平台
许可证MIT License
所有者活动
创建于2015-06-23 03:37:36
推送于2019-08-30 11:12:33
最后一次提交2018-12-03 01:11:48
发布数38
最新版本名称4.0.8 (发布于 2016-09-16 18:02:17)
第一版名称3.1.0 (发布于 2015-12-11 14:01:38)
用户参与
星数1.5k
关注者数48
派生数67
提交数310
已启用问题?
问题数48
打开的问题数25
拉请求数6
打开的拉请求数1
关闭的拉请求数3
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?