
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
A CLI tool to render Handlebars templates with partials
npm i hbsrender --save
The standard Handlebars CLI interface doesn't allow you to include sub-templates (template parts) in templates to be rendered on the server.
This module has a single purpose: to provide a CLI interface to render Handlebars templates server-side. It does that by giving you parameters to specify paths to template parts and to a JSON file containing the context.
Note: the output of this tool is not a compiled Handlebars template. The template is compiled in-memory and immediately used with the context data to generate a render.
./node_modules/.bin/hbsrender [options]
Options:
-h, --help output usage information
-V, --version output the version number
-t, --template <template> tempate to render
-p, --partial <partial> partial to make available to the template
-c, --context <context> JSON file with data to be made available to the template
You can use any number of "-p" parameters to specify as many template parts as you need. The value of the "-p" parameter must be specified in the format partial-name:path-to-file.
./node_modules/.bin/hbsrender -t main_template.hbs -c ./context.json -p part1:parts/part1.hbs -p part2:parts/part2.hbs
This will render the main_template.hbs to standard output, pulling variables for the rendering from context.json.
To render to a file you can do:
./node_modules/.bin/hbsrender [options] > output.html
In this example, inside main_template.hbs you can refer to the partials "part1" and "part2" respectively using {{#> part1}} and {{#> part2}}.
You can also provide default replacementes for a partial (should it be not provided on the command line) using the following snippet:
{{#> part1}}
...fallback content here...
{{/part1}}
This package is released under the MIT License
FAQs
Render Handlebars templates and embed partials from the command line
We found that hbsrender demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.