Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@icetee/handlebars-loader
Advanced tools
A handlebars template loader for webpack.
Handlebars 4 now supported
npm i handlebars-loader --save
{
...
module: {
rules: [
...
{ test: /\.handlebars$/, loader: "handlebars-loader" }
]
}
}
var template = require("./file.handlebars");
// => returns file.handlebars content as a template function
The loader resolves partials and helpers automatically. They are looked up relative to the current directory (this can be modified with the rootRelative
option) or as a module if you prefix with $
.
A file "/folder/file.handlebars".
{{> partial}} will reference "/folder/partial.handlebars".
{{> ../partial}} will reference "/partial.handlebars".
{{> $module/partial}} will reference "/folder/node_modules/module/partial.handlebars".
{{helper}} will reference the helper "/folder/helper.js" if this file exists.
{{[nested/helper] 'helper parameter'}} will reference the helper "/folder/nested/helper.js" if this file exists, passes 'helper parameter' as first parameter to helper.
{{../helper}} {{$module/helper}} are resolved similarly to partials.
The following query (or config) options are supported:
handlebars/runtime
../
. Setting this to be empty effectively turns off automatically resolving relative handlebars resources for items like {{helper}}
. {{./helper}}
will still resolve as expected.node_modules
directory.handlebarsLoader
.handlebarsLoader: {
partialResolver: function(partial, callback){
// should pass the partial's path on disk
// to the callback. Callback accepts (err, locationOnDisk)
}
}
handlebarsLoader: {
helperResolver: function(helper, callback){
// should pass the helper's path on disk
// to the callback if one was found for the given parameter.
// Callback accepts (err, locationOnDisk)
// Otherwise just call the callback without any arguments
}
}
See webpack
documentation for more information regarding loaders.
See the examples folder in this repo. The examples are fully runnable and demonstrate a number of concepts (using partials and helpers) -- just run webpack
in that directory to produce dist/bundle.js
in the same folder, open index.html.
See the CHANGELOG.md file.
FAQs
handlebars loader module for webpack
The npm package @icetee/handlebars-loader receives a total of 65 weekly downloads. As such, @icetee/handlebars-loader popularity was classified as not popular.
We found that @icetee/handlebars-loader 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.