Security News
Supply Chain Attack Detected in @solana/web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
docpad-plugin-handlebars
Advanced tools
Adds support for the Handlebars templating engine to DocPad.
Adds support for the Handlebars templating engine to DocPad
Convention: .(inlinejs|js|anything).(handlebars|hbs|hb)
For the plugin to support helpers and partials, you'll have to add something like the following to your docpad configuration file manually:
# ...
plugins:
handlebars:
helpers:
# Expose docpads 'getBlock' function to handlebars
getBlock: (type, additional...) ->
additional.pop() # remove the hash object
@getBlock(type).add(additional).toHTML()
partials:
title: '<h1>{{document.title}}</h1>'
goUp: '<a href="#">Scroll up</a>'
# ...
In your handlebars template you will need to use {{{content}}} to prevent handlebars from escaping any html content. You also cannot use helper functions as a parameter to {{#each collection}}, instead you should define a templateData variable and map the name to a @getCollection call e:g:
sitePages: ->
@getCollection("pages").toJSON()
If the document extension is .(inlinejs|js).(handlebars|hbs|hb)
, the plugin will produce a precompiled template. In this case, you can customise the precompiled template via the following:
# ...
plugins:
handlebars:
precompileOpts:
wrapper: "default"
# ...
Available values for the wrapper option are:
"default"
: Produces a handlebars wrapper like:
(function() {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['theSlugOfTheFile'] = template(function (Handlebars,depth0,helpers,partials,data) {
...
})
})();
"amd"
: Produces a AMD handlebars wrapper like:
define(['handlebars'], function(Handlebars) {
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
templates['theSlugOfTheFile'] = template(function (Handlebars,depth0,helpers,partials,data) {
...
});
});
"none"
: Produces a basic wrapper like:
function (Handlebars,depth0,helpers,partials,data) {
...
}
Install this DocPad plugin by entering docpad install handlebars
into your terminal.
Discover the release history by heading on over to the HISTORY.md
file.
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
These amazing people are maintaining this project:
No sponsors yet! Will you be the first?
These amazing people have contributed code to this project:
Discover how you can contribute by heading on over to the CONTRIBUTING.md
file.
Unless stated otherwise all works are:
and licensed under:
v2.9.0 2020 October 29
FAQs
Adds support for the Handlebars templating engine to DocPad.
The npm package docpad-plugin-handlebars receives a total of 5 weekly downloads. As such, docpad-plugin-handlebars popularity was classified as not popular.
We found that docpad-plugin-handlebars demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers 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
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.