/cosmic-band-site-helpers.js Secret
Created
October 17, 2017 05:48
Star
You must be signed in to star a gist
cosmic band site helpers - for article
This file contains 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
// app.js | |
// etc... | |
app.engine('handlebars', exphbs({ | |
defaultLayout: 'main', | |
partialsDir: ['views/partials/'], | |
helpers: { | |
truncateText(text, length) { | |
return truncate(text, length, { stripTags: true, byWords: true }) | |
}, | |
getYear() { | |
return moment().format('YYYY') | |
}, | |
formatDate(date) { | |
return moment(date).format('MMMM Do[,] YYYY') | |
} | |
} | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment