1.0.0 • Published 6 years ago
fis-parser-nef-handlebars v1.0.0
fis-parser-handlebars
A parser plugin for fis to precompile handlebars template.
1. 安装插件:
npm install -g fis-parser-nef-handlebars
2. 配置
// fis-conf.js
fis.config.set('modules.parser.hbst', 'handlebars');
fis.config.set('project.fileType.text', 'hbst');
fis.config.set('roadmap.ext.handlebars', 'js');
3. 使用
扩展名为hbst的handlebars模板会被编译为如下:
templates"/组件名/templates/模板名" = template(function (Handlebars,depth0,helpers,partials,data) { ...
在打包时,请对模板文件做如下包装:
(function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
// 下面是模板打包:
templates"/组件1/templates/模板1" = template(function(...)
templates"/组件1/templates/模板2" = template(function(...)
templates"/组件2/templates/模板1" = template(function(...)
})();