craigspaeth/nap — pull request #81 by manleyjster (2014-08-18 23:07:17+00:00)
Title: Fix issue #80 by adding a callback which is invoked at the end of writeFile.

I changed how `nap.package()` handles its callback, adding a callback to `writeFile` to ensure that the callback is not invoked until `writeFile` completes. I'm not sure why this works, because I see that writeFile was (seemingly) only calling synchronous methods: `fs.writeFileSync` and `mkdirp.sync` - but now, when I write, in my Gruntfile:

```javascript
grunt.task('nap', function() {
var done = this.async();

nap(site.options.nap);
nap.package(done);
}
```

`nap` runs correctly and css is correctly written to my output files.

This is a fix to [issue #80: https://github.com/craigspaeth/nap/issues/80](https://github.com/craigspaeth/nap/issues/80).