text: var gulp        = require('gulp');
  var browserSync = require('browser-sync');
  var sass        = require('gulp-sass');
  var prefix      = require('gulp-autoprefixer');
  var cp          = require('child_process');
  
  /**
   * Build the Jekyll Site
   */
  gulp.task('jekyll-build', function (done) {
      return cp.spawn( 'bundle' , ['exec', 'jekyll', 'build', '--config=_config.dev.yml'],
                {
                  stdio: 'inherit',
                  JEKYLL_ENV: 'development'
                })
             .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', ['sass', 'jekyll-build'], function() {
      browserSync({
          server: {
              baseDir: '_site'
          },
          notify: false
      });
  });
  
  /**
   * Compile files from _scss into both _site/css (for live injecting) and site (for future jekyll builds)
   */
  gulp.task('sass', function () {
      return gulp.src('_scss/main.scss')
          .pipe(sass({
              includePaths: ['scss'],
              onError: browserSync.notify,
              outputStyle: 'compressed'
          }))
          .pipe(prefix(['last 15 versions', '> 1%', 'ie 8', 'ie 7'], { cascade: true }))
          .pipe(gulp.dest('_site/css'))
          .pipe(browserSync.reload({stream:true}))
          .pipe(gulp.dest('css'));
  });
  
  /**
   * Watch scss files for changes & recompile
   * Watch html/md files, run jekyll & reload BrowserSync
   */
  gulp.task('watch', function () {
      gulp.watch('_scss/*.scss', ['sass']);
      gulp.watch(['*.html', '_layouts/*.html', '_posts/*'], ['jekyll-rebuild']);
  });
  
  /**
   * Default task, running just `gulp` will compile the sass,
   * compile the jekyll site, launch BrowserSync & watch files.
   */
  gulp.task('default', ['browser-sync', 'watch']);
  