Created
November 5, 2015 16:55
-
-
Save jonschlinkert/2df0cfd4ae170ac79e10 to your computer and use it in GitHub Desktop.
This handlebars helper is for grunt-assemble 0.4.x. Newer versions of assemble make this easier and probably not needed at all.
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
var extend = require('extend-shallow'); | |
var fs = require('fs'); | |
module.exports.register = function (handlebars, options) { | |
// you should be able to set `cwd` on assemble options in | |
// your grunt config | |
var opts = extend({cwd: ''}, options); | |
handlebars.registerHelper('include', function (filename) { | |
// to see what's on the context, do the following: | |
console.log(this); | |
var fp = path.join(opts.cwd, filename); | |
return fs.readFileSync(fp, 'utf8'); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment