首页 文章

如何使用Gulp在子文件夹中启动Jekyll?

提问于
浏览
1

“你好,世界!我如何使用Gulp在子文件夹中启动Jekyll?«

我的文件夹结构如下所示:

- foundation
- jekyll
- node_modules
gulpfile.js

要使用gulp启动jekyll,我使用此任务,如果 gulpfile.js 位于jekyll文件夹中,则该任务非常有效 .

gulp.task('jekyll', function () {
     require('child_process').spawn('jekyll', ['serve','-w'], {stdio: 'inherit'}); 
});

But how do I start jekyll in the jekyll folder if gulpfile.js is in the root directory?

1 回答

  • 1

    cwd 选项传递给spawn就可以了:

    gulp.task('jekyll', function () {
         require('child_process')
            .spawn('jekyll', ['serve','-w'], {stdio: 'inherit', cwd: 'jekyll' }); 
    });
    

    gulp jekyll

相关问题