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

scrat 如何使用 handlebars 模板? #31

Closed
gyf19 opened this issue May 14, 2015 · 11 comments
Closed

scrat 如何使用 handlebars 模板? #31

gyf19 opened this issue May 14, 2015 · 11 comments

Comments

@gyf19
Copy link

gyf19 commented May 14, 2015

好像 scrat 支持 handlebars 模板, 但是不会用呀! 文档不太详细,请@fouber大神提供例子,谢谢。
在线等回复

@fouber
Copy link
Member

fouber commented May 14, 2015

@gyf19

  1. 创建一个 .handlebars 文件,里面写上handlebars的语法,
  2. 然后去官网下载handlebars的runtime版本引擎(目前仅支持到1.3.0):http://builds.handlebarsjs.com.s3.amazonaws.com/handlebars.runtime-v1.3.0.js
  3. 然后在页面上引入这个框架
  4. 你可以在js代码中使用handlebars了:
var tpl = __inline('a.handlebars');
var data = { ... };
var html = tpl(data);
console.log(html);

@fouber fouber closed this as completed May 14, 2015
@gyf19
Copy link
Author

gyf19 commented May 14, 2015

明白了 对了,handlebars 版本是 3.0.3 。 有时间可以支持一下

@fouber
Copy link
Member

fouber commented May 14, 2015

@gyf19

可以

@gyf19
Copy link
Author

gyf19 commented May 14, 2015

components 也升级到 3.0.3 版本了。 https://github.com/components/handlebars.js

@gyf19
Copy link
Author

gyf19 commented May 14, 2015

最后谢谢 @fouber 大神热情回复

@fouber
Copy link
Member

fouber commented May 14, 2015

@gyf19

components生态后面scrat想要抛弃,感觉要死了,没什么发展

@gyf19
Copy link
Author

gyf19 commented May 14, 2015

好像 AMD 社区发展更好点 , scrat 以后怎么发展呢?

@fouber
Copy link
Member

fouber commented May 14, 2015

@gyf19

先做好工具和框架,生态接谁的都行

@fouber
Copy link
Member

fouber commented May 14, 2015

我不认为现在的amd社区的生态质量有多高,许多组件基本上不可用啊,只能在发布者自己的项目中自hi

@fouber
Copy link
Member

fouber commented May 14, 2015

@gyf19

发布了最新版的scrat@0.4.7,你升级一下吧,支持最新版handlebars,配置:

// fis-conf.js
fis.config.set('modules.parser.handlebars', 'handlebars-3.x');

@gyf19
Copy link
Author

gyf19 commented May 14, 2015

谢谢了 效率太高了

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