handlebars-helpers-sprintf-js
v1.0.0
Published
Wrap sprintf-js functions to Handlebars helpers
Downloads
5
Maintainers
Readme
handlebars-helpers-sprintf-js
Wrap sprintf-js functions to Handlebars helpers
Installation
npm install handlebars-helpers-sprintf-js
Usage
Typical
Register helpers:
const helper = require('handlebars-helpers-sprintf-js');
helper.register();
Use:
const Handlebars = require('handlebars');
const template = Handlebars.compile('{{sprintf format param}}');
template({format: '%s', param: 'a'})
In webpack.config.js
:
…
const helper = require('handlebars-helpers-sprintf-js');
…
precompileOptions: {
knownHelpers: helper.knownHelpers,
},
helperDirs: [
'handlebars-helpers-sprintf-js'
],
…