gruntjs/grunt-contrib-handlebars

minimatch support

Closed this issue · 4 comments

Ideal Config:

handlebars: {
      compile: {
          options: {
              namespace: "App.templates",
              processName: function (file_name) {
                  var name = file_name.split('/');
                  return name[name.length - 1].split('.')[0];
              },
              compilerOptions: {
                  knownHelpers: {
                      //"my-helper": true
                  },
                  knownHelpersOnly: true,
              }
          },
          files: [
              {
                  src: [
                      'src/templates/compress/*.html',
                      '!src/templates/compress/_scripts.html',
                      '!src/templates/compress/_config_logged_out.html',
                      '!src/templates/compress/__base_logged_out.html',
                      '!src/templates/compress/home_logged_out.html',
                      '!src/templates/compress/links_logged_out.html',
                      '!src/templates/compress/links_logged_out.html'
                  ],
                  dest: 'src/js/template/built/templates.js',
                  expand: true,
                  flatten: true,
                  filter: 'isFile'
              }
          ]
      }
  }

Could you explain a bit more on what you're requesting here? I see you're using expand which will expand out the files into the destination but your destination is a file instead of a folder. Please see http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

I want to be able to exclude files from the task in the config.

Try removing expand and flatten. Your file object syntax is supported in this task as it's a common syntax to all Grunt tasks.

Thanks Shama, that solved it.

Although in my config, if I reference a file !< filename > and it begins with an underscore, it adds it as a partial to the built file.