{"size": 1445, "ext": "js", "max_stars_repo_path": "gulpfile.js", "max_stars_repo_name": "way2jatin/jatinjha.github.io", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gulpfile.js", "max_issues_repo_name": "way2jatin/jatinjha.github.io", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gulpfile.js", "max_forks_repo_name": "way2jatin/jatinjha.github.io", "max_forks_repo_forks_event_min_datetime": "2018-12-29T01:38:35.000Z", "max_forks_repo_forks_event_max_datetime": "2018-12-29T01:38:35.000Z"}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 28.3333333333, "max_line_length": 77, "alphanum_fraction": 0.5882352941}
var gulp        = require('gulp'),
    clean       = require('gulp-clean'),
    stylus      = require('gulp-stylus'),
    browserSync = require('browser-sync'),
    cp          = require('child_process');

// Watch for file changes
gulp.task('watch', function() {
  gulp.watch(["!./_site/**/*.*", "styl/*.styl"], ['stylus']);
  gulp.watch(["!./_site/**/*.*", "./**/*.*", "!./styl/*.styl"], ['rebuild']);
});

// Clean built files in '_site' directory
gulp.task('clean', function() {
  return gulp.src(['_site/'], {read: false})
    .pipe(clean());
});

// Build Jekyll
gulp.task('build', function (done) {
    browserSync.notify('Building Jekyll');
    return cp.spawn('jekyll', ['build'], {stdio: 'inherit'})
        .on('close', done);
});

// Rebuild Jekyll and reload
gulp.task('rebuild', ['build'], function () {
    browserSync.reload();
});

// Compile Stylus to CSS
gulp.task('stylus', function() {
  gulp.src('styl/*.styl')
      .pipe(stylus())
      .pipe(gulp.dest('css/'))
      // Copy updated CSS into built _site directory to save rebuilding
      .pipe(gulp.dest('_site/css/'))
      // Reload browser
      .pipe(browserSync.reload({stream: true}));
});

// Serve website
gulp.task('serve', ['build'], function () {
    browserSync.init({server: {baseDir: '_site/'}});
});

// Default task to serve the website and update automatically
gulp.task('default', ['clean'], function() {
  gulp.start('stylus', 'serve', 'watch');
});
