Skip to content
Browse files

Adding in comments and fixing lint issues

  • Loading branch information...
1 parent 9d64b7d commit c1bda533afbe2223f20946c61023a9a41f2cd4a8 @davidtucker committed Jul 29, 2013
Showing with 9 additions and 2 deletions.
  1. +9 −2 tasks/wintersmith.js
View
11 tasks/wintersmith.js
@@ -7,6 +7,7 @@ module.exports = function(grunt) {
var callback = function(error) {
if(error) {
throw error;
+ done(false);
}
if(done) {
done();
@@ -19,18 +20,24 @@ module.exports = function(grunt) {
grunt.verbose.writeflags(options, 'Options');
var _ = grunt.util._;
+ // Create options object by merging user defined options and default options
options = _.defaults(options, {
action: 'build',
config: './config.json'
});
+ // This is an async task, so we need to get the done function
done = this.async();
+ // Create the Wintersmith environment using config file
var env = wintersmith(options.config);
- if(options.action == 'build') {
+ if(options.action === 'build') {
+ // Build the site using the specified options
env.build(callback);
- } else if(options.action == 'preview') {
+ } else if(options.action === 'preview') {
+ // This is asynchronous and needs to continue - be sure done isn't called
+ done = null;
env.preview(callback);
} else {
grunt.log.error('Action not supported. May be build or preview.');

0 comments on commit c1bda53

Please sign in to comment.
Something went wrong with that request. Please try again.