chore: update travis (#4)
Use swig Template Engine.
NOTE: swig is NOT MAINTAINED.
Docs: http://node-swig.github.io/swig-templates
$ npm i egg-view-swig --save
// {app_root}/config/plugin.js exports.swig = { enable: true, package: 'egg-view-swig', };
Set mapping in config
// {app_root}/config/config.default.js exports.view = { defaultViewEngine: 'swig', mapping: { '.tpl': 'swig', }, }; // {app_root}/config/config.default.js exports.swig = { cache: true, };
Set filter
// {app_root}/app/extend/filter.js exports.hello = name => `hi, ${name}.`; // {app_root}/app/controller/{your_controller}.js exports.home = function* (ctx) { yield ctx.render('home.tpl', { name: 'egg' }); }; // home.tpl {{ name | hello }}
Render in controller
// {app_root}/app/controller/test.js exports.home = function* (ctx) { yield ctx.render('home.tpl', { name: 'swig view' }); };
see config/config.default.js for more detail.
Please open an issue here.
MIT
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
egg-view-swig
Use swig Template Engine.
NOTE: swig is NOT MAINTAINED.
Docs: http://node-swig.github.io/swig-templates
Install
Usage
Set mapping in config
Set filter
Render in controller
Configuration
see config/config.default.js for more detail.
Questions & Suggestions
Please open an issue here.
License
MIT