Created
February 20, 2014 10:08
-
-
Save phobia/9110443 to your computer and use it in GitHub Desktop.
Handlebars helper for outputing a partial without handlebars parsing its contents. Useful for outputing templates to be used client side.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
module.exports.register = function(Handlebars, options) { | |
/** | |
* Raw | |
* Output a partial as raw text | |
* | |
* Usage example: | |
* {{raw "my-partial"}} | |
* | |
* To avoid escaping of html etc., use triple curly braces: | |
* {{{raw "my-partial"}}} | |
* | |
* @param {string} partialName Name of a registered partial. | |
* @return {string} | |
*/ | |
Handlebars.registerHelper('raw', function(partialName) { | |
return Handlebars.partials[partialName]; | |
}); | |
}; | |
}).call(this); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment