gruntjs/grunt-contrib-handlebars

Do not merge all source files

Closed this issue · 2 comments

Hello there!

In our project we have several handlebars source files and we need to precompile them one by one. I mean, we need to have as many compiled files as original ones.
As far as I can tell, this plugin only allows to store all precompiled templates in the same file.
Is there any configuration that allows for precompiling template files separately.

Thanks.

Every grunt task supports 1-to-1 file mapping by utilizing the expand option. Please see http://gruntjs.com/configuring-tasks#building-the-files-object-dynamically

Thank you very much.

I got what I needed with something like this:

files: [
        {
          expand: true,     // Enable dynamic expansion.
          cwd: 'lib/',      // Src matches are relative to this path.
          src: ['**/*.js'], // Actual pattern(s) to match.
          dest: 'build/',   // Destination path prefix.
          ext: '.min.js',   // Dest filepaths will have this extension.
        },
      ],