Gathering detailed insights and metrics for handlebars-template-loader-fixer
Gathering detailed insights and metrics for handlebars-template-loader-fixer
Gathering detailed insights and metrics for handlebars-template-loader-fixer
Gathering detailed insights and metrics for handlebars-template-loader-fixer
npm install handlebars-template-loader-fixer
Typescript
Module System
Node Version
NPM Version
JavaScript (96.29%)
HTML (3.71%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
45 Stars
68 Commits
11 Forks
1 Watchers
11 Branches
8 Contributors
Updated on Jun 25, 2025
Latest Version
0.5.4
Package Id
handlebars-template-loader-fixer@0.5.4
Size
10.36 kB
NPM Version
2.14.4
Node Version
4.1.1
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
4
A Handlebars template loader for Webpack
module: {
loaders: [
{ test: /\.hbs/, loader: "handlebars-template-loader" }
]
},
node: {
fs: "empty" // avoids error messages
}
};
<br>
####Loading templates
<br>
```html
<!-- File: hello.hbs -->
<p>Hello {{name}}</p>
// Get Handlebars instance var Handlebars = require('handlebars-template-loader').Handlebars;
Handlebars.registerHelper('list', function(items, options) { var out = "
for(var i=0, l=items.length; i<l; i++) { out = out + "
return out + "
Handlebars.registerHelper('link', function(text, url) { text = Handlebars.Utils.escapeExpression(text); url = Handlebars.Utils.escapeExpression(url);
var result = '' + text + '';
return new Handlebars.SafeString(result); });
<br>
```javascript
// File: main.js
// Include template helpers
require("./helpers.js");
1module.exports = { 2 //... 3 4 module: { 5 loaders: [ 6 { 7 test: /\.hbs$/, 8 loader: "handlebars-template-loader", 9 query: { 10 prependFilenameComment: __dirname, 11 } 12 } 13 ] 14 } 15};
1module.exports = { 2 //... 3 4 module: { 5 loaders: [ 6 //... 7 { test: /\.hbs/, loader: "handlebars-template-loader" }, 8 { test: /\.jpg/, loader: "file-loader" }, 9 { test: /\.png/, loader: "url-loader?mimetype=image/png" }, 10 ] 11 } 12};
1<!-- Using root = undefined => no translation --> 2<img src="/not_translated.jpg"> 3 4<!-- Using root = 'images' => require('images/image.jpg') --> 5<img src="/image.jpg">
1module.exports = { 2 //... 3 4 module: { 5 loaders: [ 6 { 7 test: /\.hbs$/, 8 loader: "handlebars-template-loader", 9 query: { 10 attributes: [] 11 } 12 } 13 ] 14 } 15};
module: {
loaders: [
{
test: /\.hbs$/,
loader: "handlebars-template-loader",
query: {
attributes: ['img:src', 'x-img:src']
}
}
]
}
};
<br>
###Macros
<br>
Macros allow additional features like including templates or inserting custom text in a compiled templates.
<br>
####The *require* macro
<br>
The `require` macro expects a path to a handlebars template. The macro is then translated to a webpack require expression that evaluates the template using the same arguments.
<br>
```html
<h4>Profile</h4>
Name: <strong>{{name}}</strong>
<br>
Surname: <strong>{{surname}}</strong>
<div class="profile-details">
@require('profile-details.hbs')
</div>
1<div class="wiki"> 2 <h3>Introduction</h3> 3 @include('intro.htm') 4 <h3>Authors</h3> 5 @include('authors.htm') 6</div>
1<p>Lorem ipsum</p> 2@br(3) 3<p>Sit amet</p> 4@nl()
module: {
loaders: {
// ...
{ test: /\.hbs/, loader: "handlebars-template-loader" },
}
},
macros: {
copyright: function () {
return "'<p>Copyright FakeCorp 2014 - 2015</p>'";
}
}
}
<br>
We then invoke our macro from within the template as usual.
<br>
```html
<footer>
@copyright()
</footer>
module: {
loaders: {
// ...
{
test: /\.hbs/,
loader: "handlebars-template-loader",
query: {
parseMacros: false
}
},
}
}
}
<br>
####Arguments
<br>
Macros can accept an arbitrary number of arguments. Only boolean, strings and numeric types are supported.
<br>
```javascript
// File: webpack.config.js
module.exports = {
// ...
module: {
loaders: {
// ...
{ test: /\.html$/, loader: "underscore-template-loader" },
}
},
macros: {
header: function (size, content) {
return "'<h" + size + ">" + content + "</h" + size + ">'";
}
}
}
Lorem ipsum
@header(3, 'Contents')Sit amet
```Released under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
6 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 4/30 approved changesets -- score normalized to 1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More