Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime 设计 #2

Open
popomore opened this issue May 15, 2013 · 2 comments
Open

runtime 设计 #2

popomore opened this issue May 15, 2013 · 2 comments

Comments

@popomore
Copy link
Member

与 templatable 区别

  • runtime 直接给 handlebars 用的,template 只支持函数
  • 模板以 .handlebars 结尾,spm 会编译成 cmd 模块,开发环境使用 plugin-handlebars.js
  • 用户使用的时候需要自己编译模板,实例化的时候无法传入字符串。所以比较适合像 calendar 这种没啥修改模板的组件
  • 去掉 renderPartial
  • 增加 compile 方法,重新全局渲染
  • 不再使用 this.model 和 this.template,取而代之使用属性

review 下现有代码

https://github.com/aralejs/templatable/blob/master/src/runtime.js

compile 也可以支持简单的 selector

  • 用 jquery 实现 this.element.html($(this._compile()).find(selector).html());
  • 用正则匹配,不过只能支持常使用的选择器
@lepture
Copy link

lepture commented May 16, 2013

不要叫 runtime,就叫 handlebars

@popomore
Copy link
Member Author

那叫 handlebars-runtime 吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants