Created
January 16, 2014 17:12
-
-
Save sergeyt/8459018 to your computer and use it in GitHub Desktop.
Meteor handlebars template helpers
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
# Handlebars helpers | |
return if (typeof Handlebars == 'undefined') | |
Handlebars.registerHelper "timeago", (date) -> | |
return 'some time ago' if not date | |
dateObj = new Date(date) | |
return moment(dateObj).fromNow().replace(/\ /g, '\u00a0') | |
Handlebars.registerHelper "gravatar", (email, size) -> | |
Gravatar.imageUrl(email, {s: size}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment