2016-03-31 14:17:50 +00:00
|
|
|
var gulp = require('gulp');
|
|
|
|
var browserSync = require('browser-sync');
|
|
|
|
var cp = require('child_process');
|
|
|
|
|
|
|
|
var messages = {
|
|
|
|
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Build the Jekyll Site
|
|
|
|
*/
|
|
|
|
gulp.task('jekyll-build', function (done) {
|
|
|
|
browserSync.notify(messages.jekyllBuild);
|
2017-01-03 13:49:57 +00:00
|
|
|
return cp.spawn('bundle', ['exec','jekyll','build'], {stdio: 'inherit'})
|
2016-03-31 14:17:50 +00:00
|
|
|
.on('close', done);
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Rebuild Jekyll & do page reload
|
|
|
|
*/
|
|
|
|
gulp.task('jekyll-rebuild', ['jekyll-build'], function () {
|
|
|
|
browserSync.reload();
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Wait for jekyll-build, then launch the Server
|
|
|
|
*/
|
|
|
|
gulp.task('browser-sync', ['jekyll-build'], function() {
|
2016-03-31 17:26:15 +00:00
|
|
|
browserSync.init({
|
|
|
|
server: '_site'
|
2016-03-31 14:17:50 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Watch html/md files, run jekyll & reload BrowserSync
|
|
|
|
* if you add folder for pages, collection or datas, add them to this list
|
|
|
|
*/
|
|
|
|
gulp.task('watch', function () {
|
2016-03-31 17:26:15 +00:00
|
|
|
gulp.watch(['./*', '_layouts/*', '_includes/*', '_posts/*', '_sass/*', 'css/*', 'jabber/*', 'keysigning/*'], ['jekyll-rebuild']);
|
2016-03-31 14:17:50 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default task, running just `gulp` will compile the sass,
|
|
|
|
* compile the jekyll site, launch BrowserSync & watch files.
|
|
|
|
*/
|
2017-01-03 13:49:57 +00:00
|
|
|
gulp.task('default', ['browser-sync', 'watch']);
|