gruntjs / grunt-contrib-handlebars

Precompile Handlebars templates to JST file.
http://gruntjs.com/
MIT License
282 stars 126 forks source link

Do not merge all source files #82

Closed PaquitoSoft closed 11 years ago

PaquitoSoft commented 11 years ago

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.

tkellen commented 11 years ago

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

PaquitoSoft commented 11 years ago

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.
        },
      ],