1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| var gulp = require("gulp"), connect = require("gulp-connect"), markdown = require("gulp-markdown");
gulp.task("connect", function() {
connect.server({ port: 3000, root: "source/md2html/", livereload: true,
}); });
gulp.task('html', function() { gulp.src(['./source/md2html/*.html']) .pipe(connect.reload()); });
gulp.task('md2html', function() { gulp.src(['./source/_posts/*.md']) .pipe(markdown()) .pipe(gulp.dest('./source/md2html')) .pipe(connect.reload()); });
gulp.task('watch', function() { gulp.watch(['./source/_posts/*.md'], ['md2html']); gulp.watch(['./source/md2html/*.html'], ['html']); });
gulp.task("default", ['connect', 'watch']);
|