egg-view-xtpl
egg view plugin for xtemplate
Last updated 4 months ago by ngot .
MIT · Repository · Bugs · Original npm · Tarball
$ cnpm install egg-view-xtpl 
SYNC missed versions from official npm registry.

egg-view-xtpl

NPM version build status Test coverage David deps Known Vulnerabilities npm download

egg view plugin for xtemplate.

Install

$ npm i egg-view-xtpl --save

Usage

Configuration

// {app_root}/config/plugin.js
exports.xtpl = {
  enable: true,
  package: 'egg-view-xtpl',
};
// {app_root}/config/config.default.js
exports.view = {
  mapping: {
    '.xtpl': 'xtpl',
  },
};

// xtpl config
exports.xtpl = {};

see config/config.default.js for more detail.

Example

Demo

// app/view/hello.xtpl
hello {{ data }}

Render it

// app/controller/render.js
exports.xtpl = function* () {
  yield this.render('hello.xtpl', {
    data: 'world',
  });
};

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.

License

MIT

Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 7
Dependencies (5)
Dev Dependencies (10)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |