patrickkettner / grunt-compile-handlebars

grunt plugin to compile static html from a handlebars plugin
MIT License
115 stars 29 forks source link

Add ability to have a function be templateData #67

Open thejsj opened 8 years ago

thejsj commented 8 years ago

This is useful if you want to use something dynamically generated during the build process and want to somehow do something with that. Here's an example:

        templateData: function () {
          var envConfig = require('./client/config/json/environment.json');
          return {
            version: version,
            env: envConfig.environment,
            commitHash: envConfig.commitHash,
            commitTime: envConfig.commitTime,
            apiHost: envConfig.host
          };
        },

Would be happy to add tests/documentation/w/e else is needed if you're interested in adding this in.

patrickkettner commented 8 years ago

Awesome! Could you add a test for this, please?

patrickkettner commented 8 years ago

ping @thejsj

thejsj commented 8 years ago

Let me see if I can take a look at this this weekend :)

ahc-andrew commented 7 years ago

I would love this functionality as well