mirror of
https://github.com/JuanCanham/HackMyResume.git
synced 2025-05-10 07:47:07 +01:00
Improve Underscore.js rendering support.
This commit is contained in:
34
src/helpers/underscore-helpers.js
Normal file
34
src/helpers/underscore-helpers.js
Normal file
@ -0,0 +1,34 @@
|
||||
/**
|
||||
Template helper definitions for Underscore.
|
||||
@license MIT. Copyright (c) 2016 hacksalot (https://github.com/hacksalot)
|
||||
@module handlebars-helpers.js
|
||||
*/
|
||||
|
||||
|
||||
(function() {
|
||||
|
||||
var HANDLEBARS = require('handlebars')
|
||||
, _ = require('underscore')
|
||||
, helpers = require('./generic-helpers');
|
||||
|
||||
/**
|
||||
Register useful Underscore helpers.
|
||||
@method registerHelpers
|
||||
*/
|
||||
module.exports = function( theme, opts, cssInfo, ctx, eng ) {
|
||||
|
||||
helpers.theme = theme;
|
||||
helpers.opts = opts;
|
||||
helpers.cssInfo = cssInfo;
|
||||
helpers.engine = eng;
|
||||
ctx.h = helpers;
|
||||
|
||||
_.each( helpers, function( hVal, hKey ) {
|
||||
if( _.isFunction( hVal )) {
|
||||
_.bind( hVal, ctx );
|
||||
}
|
||||
}, this);
|
||||
|
||||
};
|
||||
|
||||
}());
|
Reference in New Issue
Block a user