tasks/buildHtml.js
function (tplName, data, ignoreEvaluation) {
      var files, templateData, html = '';
      if (typeof data !== 'object') {
        ignoreEvaluation = data;
        data = {};
      }
      data = _.extend({}, options.data, data);
      if (_.has(templates, tplName)) {
        debug('  include ' + templates[tplName].filepath);
        files = _.clone(this.files);
        files.push(templates[tplName].filepath);
        templateData = {
          files: files
        };
        data.include = include.bind(templateData);
        try {
          if (ignoreEvaluation) {
            html = templates[tplName].content;
          } else {
            html = _.template(templates[tplName].content, options.templateSettings)(data);
          }
        } catch (error) {
          grunt.log.error(error.message);
          backtrace(files);
        }
      } else {
        grunt.log.writeln('Template "' + tplName + '" does not exists.');
        backtrace(this.files);
      }
      return html;
    }
function (tplName, data, ignoreEvaluation) {
      var files, templateData, html = '';
      if (typeof data !== 'object') {
        ignoreEvaluation = data;
        data = {};
      }
      data = _.extend({}, options.data, data);
      if (_.has(templates, tplName)) {
        debug('  include ' + templates[tplName].filepath);
        files = _.clone(this.files);
        files.push(templates[tplName].filepath);
        templateData = {
          files: files
        };
        data.include = include.bind(templateData);
        try {
          if (ignoreEvaluation) {
            html = templates[tplName].content;
          } else {
            html = _.template(templates[tplName].content, options.templateSettings)(data);
          }
        } catch (error) {
          grunt.log.error(error.message);
          backtrace(files);
        }
      } else {
        grunt.log.writeln('Template "' + tplName + '" does not exists.');
        backtrace(this.files);
      }
      return html;
    }
function ( tplName , data , ignoreEvaluation ) { var files , templateData , html = '' ; if ( typeof data !== 'object' ) { ignoreEvaluation = data ; data = { } ; } data = _ . extend ( { } , options . data , data ) ; if ( _ . has ( templates , tplName ) ) { debug ( '  include ' + templates [ tplName ] . filepath ) ; files = _ . clone ( this . files ) ; files . push ( templates [ tplName ] . filepath ) ; templateData = { files : files } ; data . include = include . bind ( templateData ) ; try { if ( ignoreEvaluation ) { html = templates [ tplName ] . content ; } else { html = _ . template ( templates [ tplName ] . content , options . templateSettings ) ( data ) ; } } catch ( error ) { grunt . log . error ( error . message ) ; backtrace ( files ) ; } } else { grunt . log . writeln ( 'Template "' + tplName + '" does not exists.' ) ; backtrace ( this . files ) ; } return html ; }
Include method to be used in HTML files.
@param tplName Relative template path
@param data The data object used to populate the text.
@returns {string} Compiled template content
Include method to be used in HTML files .