Phlow
Phlow

Reputation: 706

How do I use Gulp to start Jekyll in a subfolder?

»Hello world! How do I use Gulp to start Jekyll in a subfolder?«

My folder structure looks like this:

- foundation
- jekyll
- node_modules
gulpfile.js

To start jekyll with gulp I use this task, which works perfect if the gulpfile.js is in the jekyll-folder.

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?

Upvotes: 1

Views: 244

Answers (1)

David Jacquel
David Jacquel

Reputation: 52789

Passing the cwd option to spawn did the trick :

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

And gulp jekyll !

Upvotes: 1

Related Questions