2014-07-09 2 views
1

»Hello world! 어떻게 하위 폴더에 지킬를 시작하는 꿀꺽 사용합니까«Gulp를 사용하여 하위 폴더에서 지킬을 시작하려면 어떻게해야합니까?

내 폴더 구조는 다음과 같습니다?

- foundation 
- jekyll 
- node_modules 
gulpfile.js 

gulpfile.js이있는 경우 완벽하게 작동 나는이 작업을 사용 꿀꺽와 지킬를 시작하려면 지킬 - 폴더.

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

하지만 어떻게 gulpfile.js 루트 디렉토리에있는 경우 내가 지킬 폴더에 지킬를 시작합니까?

답변

1

트릭했던 산란 할 수있는 CWD 옵션을 전달 :

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

그리고 꿀꺽의 지킬을!

+0

정말 고마워요. 'cwd'는 무엇을위한 것인가? 그것에 관한 문서를 찾을 수있는 링크가 있습니까? 고맙습니다. 이렇게하면 내 gulpfile.js가 빛나게됩니다. – Phlow

+0

이 경우 node.js doc을 참조하십시오. http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options –

+0

답장을 보내 주셔서 다시 한 번 감사드립니다. – Phlow

관련 문제