Skip to content

Commit

Permalink
QOLOE-54 adjust handlebars.helpers.js to invoke IIFE function
Browse files Browse the repository at this point in the history
  • Loading branch information
stvp-qld committed May 17, 2024
1 parent 5c3de8e commit bd648be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions esbuild.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ const buildConfig = {
out: "./assets/css/qld.bootstrap",
},
{
in: "./src/js/handlebars.init.js",
in: "./src/js/handlebars.helpers.js",
out: "./assets/js/handlebars.helpers.bundle",
},
{
in: "./src/js/handlebars.init.js",
out: "./components/handlebars.helpers.bundle",
out: "./components/handlebars.init.bundle",
},
],

Expand Down
5 changes: 5 additions & 0 deletions src/js/handlebars.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

export default function handlebarsHelpers(Handlebars) {

Handlebars.registerHelper("contains", function (needle, haystack, options) {
needle = Handlebars.escapeExpression(needle);
haystack = Handlebars.escapeExpression(haystack);
Expand Down Expand Up @@ -51,3 +52,7 @@ export default function handlebarsHelpers(Handlebars) {
return ((index + 1) % 3 === 0); // Since index is zero-based, add 1 to check if it's the end of a row.
});
}

if(typeof(Handlebars) !== 'undefined') {
handlebarsHelpers(Handlebars);

Check failure on line 57 in src/js/handlebars.helpers.js

View workflow job for this annotation

GitHub Actions / Lint, Test, Build and Deploy on Node 20

'Handlebars' is not defined

Check failure on line 57 in src/js/handlebars.helpers.js

View workflow job for this annotation

GitHub Actions / Lint, Test, Build and Deploy on Node 20

'Handlebars' is not defined
}

0 comments on commit bd648be

Please sign in to comment.