Skip to content

scrat-team/fis-parser-handlebars-4.x

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fis-parser-handlebars-4.x

A parser plugin for fis to precompile handlebars v4.x template.

1. 安装插件:

npm install -g fis-parser-handlebars-4.x

2. 配置

// fis-conf.js
fis.config.set('modules.parser.handlebars', 'handlebars-4.x');
fis.config.set('project.fileType.text', 'handlebars');
fis.config.set('roadmap.ext.handlebars', 'js');

3. 使用

创建foo.handlebars的模板文件,其中的内容是:

<div class="entry">
  <h1>{{title}}</h1>
  <div class="body">
    {{body}}
  </div>
</div>

创建foo.js的js文件,内容是:

var tpl = __inline('foo.handlebars');
var context = {title: "My New Post", body: "This is my first post!"};
var html = console.log(tpl(context));
console.log(html);

在页面上引入handlebars的 runtime版本 作为运行时模板引擎框架。

Demo

fis3 use-handlebars-4.x

About

A parser plugin for fis to precompile handlebars v4.x template

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published