Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eggjs/egg-view-handlebars
egg view plugin for handlebars
https://github.com/eggjs/egg-view-handlebars
egg egg-plugin egg-view handlebars
Last synced: about 1 month ago
JSON representation
egg view plugin for handlebars
- Host: GitHub
- URL: https://github.com/eggjs/egg-view-handlebars
- Owner: eggjs
- License: mit
- Created: 2017-02-25T15:23:33.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-10-30T06:52:42.000Z (about 6 years ago)
- Last Synced: 2024-04-14T02:21:03.579Z (8 months ago)
- Topics: egg, egg-plugin, egg-view, handlebars
- Language: JavaScript
- Size: 53.7 KB
- Stars: 12
- Watchers: 13
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: History.md
- License: LICENSE
Awesome Lists containing this project
- awesome-egg - egg-view-handlebars - Egg view plugin for handlebars ![](https://img.shields.io/github/stars/eggjs/egg-view-handlebars.svg?style=social&label=Star) ![](https://img.shields.io/npm/dm/egg-view-handlebars.svg?style=flat-square) (仓库 / 插件)
README
# egg-view-handlebars
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![David deps][david-image]][david-url]
[![Known Vulnerabilities][snyk-image]][snyk-url]
[![npm download][download-image]][download-url][npm-image]: https://img.shields.io/npm/v/egg-view-handlebars.svg?style=flat-square
[npm-url]: https://npmjs.org/package/egg-view-handlebars
[travis-image]: https://img.shields.io/travis/eggjs/egg-view-handlebars.svg?style=flat-square
[travis-url]: https://travis-ci.org/eggjs/egg-view-handlebars
[codecov-image]: https://img.shields.io/codecov/c/github/eggjs/egg-view-handlebars.svg?style=flat-square
[codecov-url]: https://codecov.io/github/eggjs/egg-view-handlebars?branch=master
[david-image]: https://img.shields.io/david/eggjs/egg-view-handlebars.svg?style=flat-square
[david-url]: https://david-dm.org/eggjs/egg-view-handlebars
[snyk-image]: https://snyk.io/test/npm/egg-view-handlebars/badge.svg?style=flat-square
[snyk-url]: https://snyk.io/test/npm/egg-view-handlebars
[download-image]: https://img.shields.io/npm/dm/egg-view-handlebars.svg?style=flat-square
[download-url]: https://npmjs.org/package/egg-view-handlebarsegg view plugin for handlebars
## Install
```bash
$ npm i egg-view-handlebars --save
```## Usage
```js
// {app_root}/config/plugin.js
exports.handlebars = {
enable: true,
package: 'egg-view-handlebars',
};
``````js
// {app_root}/config/config.default.js
/**
* view
* @member
* @property defaultViewEngine: string setup default view engine
* @property defaultExtension: string template file extension
* @property mapping: Object {string: string}
*/
exports.view = {
defaultViewEngine: 'handlebars',
defaultExtension: '.hbs',
mapping: {
'.hbs': 'handlebars',
},
};
```### Register Partial
Partials are loaded from `app/view/partials` by default, you can define `user_message.hbs` and use `userMessage` as partial.
Note:
- The file name will be camelized, e.x. `foo_bar > fooBar`, `foo-bar > fooBar`
- Don't support cascade directory## Configuration
see [config/config.default.js](config/config.default.js) for more detail.
## Questions & Suggestions
Please open an issue [here](https://github.com/eggjs/egg/issues).
## License
[MIT](LICENSE)