dwightjack / grunt-premailer

Grunt wrapper task for Premailer
MIT License
114 stars 16 forks source link

When passing multiple file targets, you end up with the contents of the last file #5

Closed cdarken closed 10 years ago

cdarken commented 10 years ago

If you have something like:

files: {
  'target1.html': ['source1.html'],
  'target2.html': ['source2.html']
}

you end up with the contents of source2.html in target1.html and target2.html.

I tracked the issue to the line 97 in the task file:

tmpFile = path.join(path.dirname(f.dest), '_tmp_premailer.html');

I guess this happens because the task runs async.

My quick fix was:

tmpFile = path.join(path.dirname(f.dest), '_tmp_premailer_'+ path.basename(f.dest, '.html') +'.html');
dwightjack commented 10 years ago

You are totally right.

Will look to fix the bug in the next release.

dwightjack commented 10 years ago

Hi,

solved in release 0.2.2.

Thanx for contributing!