Skip to content

Instantly share code, notes, and snippets.

@jcblw
Last active December 1, 2019 23:28
Show Gist options
  • Save jcblw/5941917 to your computer and use it in GitHub Desktop.
Save jcblw/5941917 to your computer and use it in GitHub Desktop.
This is some useful helpers that allow you to use handlebar templates with connect-assets in node.js
module.exports = function( hbs ){
hbs.registerHelper( "js", function( context ){
if( typeof js === "function" ){
return js( context );
}else{
return ""
}
});
hbs.registerHelper( "css", function( context ){
if( typeof css === "function" ){
return css( context );
}else{
return ""
}
});
};
<!doctype html>
{{{css "main"}}}
<p> Yeah </p>
{{{js "main"}}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment