https://github.com/coco-platform/handlebars-extension
A lite collection of handlebars extensions within MVC.
https://github.com/coco-platform/handlebars-extension
Last synced: 2 months ago
JSON representation
A lite collection of handlebars extensions within MVC.
- Host: GitHub
- URL: https://github.com/coco-platform/handlebars-extension
- Owner: coco-platform
- Created: 2018-06-05T03:53:53.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-04-15T22:05:05.000Z (about 2 years ago)
- Last Synced: 2025-10-16T20:46:20.727Z (9 months ago)
- Language: TypeScript
- Size: 438 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @coco-platform/handlebars-extension

[](https://coveralls.io/github/coco-platform/handlebars-extension?branch=master) [](https://greenkeeper.io/)


A specific handlebars extension collection within MVC.
## Usage
```javascript
const { inline, link } = require('@coco-platform/handlebars-extension');
const context = {
resources: [
'https://static.zhihu.com/heifetz/main.app.c994694b7b8c848b345c.css',
{
rel: 'dns-prefetch',
href: `//static.zhimg.com`,
},
'https://static.zhihu.com/heifetz/main.app.c994694b7b8c848b345c.js',
{
src:
'https://static.zhihu.com/heifetz/main.signflow.6af7025179e6b1979aca.js',
crossorigin: true,
},
],
criticals: [
{
type: 'stylesheet',
content:
'.CloseIcon-icon-2xww{transition:opacity .3s ease-out}.CloseIcon-icon-2xww:hover{opacity:.8}',
},
{
type: 'script',
content: `(function($) {$(document).ready(() => {});})(jQuery);`,
},
],
};
hbs.registerHelper('inline', inline);
hbs.registerHelper('link', link);
```
```handlebars
{{#each criticals as | critical |}}
{{inline critical}}
{{/each}}
{{#each resources as | resource |}}
{{link resource}}
{{/each}}
```
# Licence
MIT