gruntjs/grunt-contrib-handlebars

How to use processPartialName & processContent functions?

Closed this issue · 2 comments

Hey,

My processPartialName and processContent functions don't seem to be getting called or used. Am I doing something incorrectly?

        handlebars: {
            compile: {
                files: {
                    "assets/js/views.js":
                    "assets/js/view/*.mustache"
                },
                options: {
                    namespace: "App.views",
                    processPartialName: function(filePath) {
                      var segments = filePath.split("/");
                      return segments[segments.length - 1];
                    },
                    processContent: function(content) {
                        content = content.replace(/^[\x20\t]+/mg, '').replace(/[\x20\t]+$/mg, '');
                        content = content.replace(/^[\r\n]+/, '').replace(/[\r\n]*$/, '\n');
                        return content;
                    }
                }
            }
        }

And running the following:

$ grunt handlebars

I'm using the following (Mac):

grunt-contrib-handlebars: v0.5.9
Node: v0.8.8
Grunt: v0.4.1

Options should be over files

I think you are not using partials. If you just want to rename the template name, use this

    processName: function(filename) {
      var pieces = filename.split("/");
      return pieces[pieces.length - 1];
   }