2015-02-06 68 views
-1

我試圖運行jekyll build作爲gulp文件中的節點子進程。問題是,jekyll build似乎正在運行多次,並從未關閉。作爲節點子進程運行時Jekyll構建不關閉

我能想到的唯一可能是jekyll build進程修改降價文件,這將導致gulp.watch再次運行。我沒有看到這方面的任何證據。

如果我只是從終端運行jekyll build我得到這個:

Configuration file: /home/user_name/projects/project_name/_config.yml 
      Source: /home/user_name/projects/project_name 
     Destination: /home/user_name/projects/project_name/_site 
     Generating... 
        done. 
Auto-regeneration: disabled. Use --watch to enable. 

當我運行它作爲一個子節點過程中,我得到這個:

[20:59:03] Configuration file: /home/user_name/projects/project_name/_config.yml 
      Source: /home/user_name/projects/project_name 
     Destination: /home/user_name/projects/project_name/_site 
     Generating... 

[20:59:03] Configuration file: /home/user_name/projects/project_name/_config.yml 
      Source: /home/user_name/projects/project_name 
     Destination: /home/user_name/projects/project_name/_site 
     Generating... 

[20:59:03] Configuration file: /home/user_name/projects/project_name/_config.yml 
      Source: /home/user_name/projects/project_name 
     Destination: /home/user_name/projects/project_name/_site 
     Generating... 

它不斷重複這樣的20+然後停止並在此之後不輸出任何內容。

這裏是我的gulpfile.js:

var gulp = require('gulp'); 
var spawn = require('child_process').spawn; 
var gutil = require('gulp-util'); 

gulp.task('default', function() { 
    gulp.watch('**/*.md', function (e) { 
    var cp  = spawn('jekyll', ['build']), 
     stdout = '', 
     stderr = ''; 

    cp.stdout.setEncoding('utf8'); 

    cp.stdout.on('data', function (data) { 
     stdout += data; 
     gutil.log(data); 
    }); 

    cp.stderr.setEncoding('utf8'); 

    cp.stderr.on('data', function (data) { 
     stderr += data; 
     gutil.log(gutil.colors.red(data)); 
    }); 

    cp.on('error', function (err) { 
     gutil.log(gutil.colors.red('gulp-jekyll', err)); 
    }); 

    cp.on('close', function (code) { 
     gutil.log('Done with exit code ', code); 
     gutil.log('Jekyll has completed the build process.'); 
    }); 

    }); 
}); 

回答

-1

好吧,看來問題是我忘了排除在哲基爾_config.yml文件我node_modules目錄。肯定有這麼多markdown文件,它不堪重負jekyll。

不過,我不知道爲什麼他們甚至首先觸發了gulp.watch,因爲他們沒有被編輯。

相關問題