1.0.0 • Published 5 years ago

handlebars-helpers-sprintf-js v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

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'})

handlebars-loader

In webpack.config.js:

…
const helper = require('handlebars-helpers-sprintf-js');
…
                        precompileOptions: {
                            knownHelpers: helper.knownHelpers,
                        },
                        helperDirs: [
                            'handlebars-helpers-sprintf-js'
                        ],
…