Skip to content

基于egg-view-swig插件扩展, 支持scrat pagelet 模式

License

Notifications You must be signed in to change notification settings

scrat-team/egg-view-swig-pagelet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

d5927ae · Apr 13, 2018

History

24 Commits
Apr 13, 2018
Dec 20, 2017
Dec 20, 2017
Jun 8, 2017
Apr 12, 2017
Apr 12, 2017
Jun 8, 2017
Apr 13, 2018
Apr 13, 2018
Apr 11, 2017
Apr 12, 2017
Dec 26, 2017
Apr 13, 2018

Repository files navigation

egg-view-swig-pagelet

Support the view rendering implementation of the scrat pagelet. Depends on the egg-view-swig template view engine.

Pagelet: https://github.com/scrat-team/scrat-swig

NOTE: swig is NOT MAINTAINED.

DOCS: http://node-swig.github.io/swig-templates

Install

$ npm i egg-view-swig-pagelet --save

Usage

// {app_root}/config/plugin.js
exports.swigPagelet = {
  enable: true,
  package: 'egg-view-swig-pagelet',
};
// {app_root}/config/config.default.js
exports.swigPagelet = {
  // default layout template config for view base dir
  // layout: 'layout/layout.tpl',
  // default scrat resource manifest path
  // manifest: path.join(app.baseDir, 'config/manifest.json')
};

Render in controller

exports.home = function* (ctx) {
  yield ctx.render('home.tpl', { list });
};

Configuration

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

Questions & Suggestions

Please open an issue here.

License

MIT