https://github.com/scrat-team/egg-view-swig-pagelet
基于egg-view-swig插件扩展, 支持scrat pagelet 模式
https://github.com/scrat-team/egg-view-swig-pagelet
egg egg-plugin egg-view pagelet scrat swig
Last synced: 3 months ago
JSON representation
基于egg-view-swig插件扩展, 支持scrat pagelet 模式
- Host: GitHub
- URL: https://github.com/scrat-team/egg-view-swig-pagelet
- Owner: scrat-team
- License: mit
- Created: 2017-04-11T10:23:22.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-04-13T11:29:15.000Z (over 7 years ago)
- Last Synced: 2025-06-18T12:56:43.943Z (4 months ago)
- Topics: egg, egg-plugin, egg-view, pagelet, scrat, swig
- Language: JavaScript
- Size: 123 KB
- Stars: 4
- Watchers: 13
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
README
# egg-view-swig-pagelet
Support the view rendering implementation of the scrat pagelet. Depends on the [egg-view-swig](https://github.com/eggjs/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
```bash
$ npm i egg-view-swig-pagelet --save
```## Usage
```js
// {app_root}/config/plugin.js
exports.swigPagelet = {
enable: true,
package: 'egg-view-swig-pagelet',
};
``````js
// {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
```js
exports.home = function* (ctx) {
yield ctx.render('home.tpl', { list });
};
```## Configuration
see [config/config.default.js](config/config.default.js) for more detail.
## Questions & Suggestions
Please open an issue [here](https://github.com/scrat-team/egg-view-swig-pagelet/issues).
## License
[MIT](LICENSE)