@coco-platform/handlebars-extension
v0.3.1
Published
A specific handlebars extension collection within MVC.
Downloads
5
Readme
@coco-platform/handlebars-extension
A specific handlebars extension collection within MVC.
Usage
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);
{{#each criticals as | critical |}}
{{inline critical}}
{{/each}}
{{#each resources as | resource |}}
{{link resource}}
{{/each}}
Licence
MIT