thierryc / grunt-handlebars-layouts

A grunt.js task to render Handlebars templates against a context & produce HTML
MIT License
14 stars 10 forks source link

Multiple files #1

Closed okendoken closed 10 years ago

okendoken commented 10 years ago

Hi there!

Thanks for your efforts - grunt-handlebars-layouts is exactly what I was looking for.

I have question: Is it possible to compile multiple templates simultaneously? Something like that:

'handlebarslayouts': {
    files: {
        src: 'src/*.hbs',
        dest: 'dest/*.html'
    }
}

I am getting the following error now:

Warning: Unable to write "dest/*.html" file (Error code: ENOENT). Use --force to continue.
Aborted due to warnings.

Thanks

thierryc commented 10 years ago

Hi,

For the moment you can't like this.

'handlebarslayouts': {
    files: {
        src: 'src/*.hbs',
        dest: 'dest/*.html'
    }
}

'src/desitnation-file.html': 'src/source-file.hbs',

You can list your files like :

'handlebarslayouts': {
    files: {
          'src/index.html': 'src/index.hbs',
          'src/week-end.html': 'src/week-end.hbs',
          'src/event.html': 'src/event.hbs',
          'src/event-edit.html': 'src/event-edit.hbs',
          'src/event-add.html': 'src/event-add.hbs',
          'src/artists.html': 'src/artists.hbs',
          'src/artist.html': 'src/artist.hbs',
          ...
      }
}

or create a function to return an object like it.

I add this feature in my todo list.

Best regards

thierryc commented 10 years ago

Try the last version :8ball:

okendoken commented 10 years ago

Wow man! thanks for such a quick fix!

Can compile multiple files now.

Btw, when tried to install your plugin on windows via npm or just git-clone it, it fails, as you have a file named *.html in your example/dist folder, which is not supported by windows.

Thanks once again!

thierryc commented 10 years ago

Ooups…. I do nto have Windows on my computer. I try to fix it tomorrow.

thierryc commented 10 years ago

I do it !

thierryc commented 10 years ago

Tel me if this news version rocks for you on windows.

okendoken commented 10 years ago

Yep, all good now :+1:

thierryc commented 10 years ago

Perfect, I close this issue.