egg-view-xtpl
egg view plugin for xtemplate.
Install
$ npm i egg-view-xtpl --save
Usage
Configuration
// {app_root}/config/plugin.jsexportsxtpl = enable: true package: 'egg-view-xtpl';
// {app_root}/config/config.default.jsexportsview = mapping: '.xtpl': 'xtpl' ; // xtpl configexportsxtpl = {};
see config/config.default.js for more detail.
Example
Demo
// app/view/hello.xtplhello {{ data }}
Render it
// app/controller/render.jsexports { this;};
Include
You can include relative file.
// app/view/a.xtpl include app/view/b.xtpl{{ include('./b.xtpl') }}
// app/view/a.xtpl include app/view/c.xtpl{{ include('c.xtpl') }}
// app/view/banner/item.xtpl include app/view/footer/logo.xtpl{{ include('../footer/logo.xtpl') }}
Questions & Suggestions
Please open an issue here.