Skip to content

Instantly share code, notes, and snippets.

Created Jul 5, 2015
What would you like to do?
Livereload via Gulp and Jekyll build
var gulp = require('gulp');
var cp = require('child_process');
var shell = require('gulp-shell');
var express = require('express');
var livereload = require('gulp-livereload');
gulp.task('default', ['watch']);
// Run static file server
gulp.task('serve', function () {
var server = express();
// Watch for changed files
gulp.task('watch', ['jekyll', 'serve'], function () {
// Create LiveReload server
livereload.listen({ port: 35729, basePath: '_site' });
// Watch files, reload on change'_site/**').on('change', function (file) {
});['./*.html', '_layouts/*.haml', '_includes/*.haml', '**/*.md', '_sass/**/*.scss', './images/**/*', '!_site/**', '!_site/**/*'], ['jekyll']);
// Compile pages with Jekyll
gulp.task('jekyll', function () {
return cp.spawn('jekyll', ['build']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment