Created
September 17, 2014 12:08
-
-
Save andyyou/d3a5f9ef1cc7d6fcebfa to your computer and use it in GitHub Desktop.
The question?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var gulp = require("gulp"), | |
connect = require("gulp-connect"), | |
less = require("gulp-less"), | |
react = require("gulp-react"), | |
watch = require("gulp-watch"), | |
jade = require("gulp-jade"), | |
clean = require("gulp-clean"); | |
/** | |
* Compilers | |
*/ | |
gulp.task("less", ["clean-css"], function () { | |
gulp.src("playground/src/styles/less/*.less") | |
.pipe(less()) | |
.pipe(gulp.dest("playground/dist/css")); | |
}); | |
gulp.task("clean-css", function () { | |
gulp.src("playground/dist/css/*", {read: false}).pipe(clean({force: true})); | |
}); | |
gulp.task("jsx", ["clean-js"], function () { | |
gulp.src("playground/src/scripts/jsx/*.jsx") | |
.pipe(react()) | |
.pipe(gulp.dest("playground/dist/js/")); | |
}); | |
gulp.task("clean-js", function () { | |
gulp.src("playground/dist/js/*", {read: false}).pipe(clean({force: true})); | |
}); | |
gulp.task("jade", ["clean-html"], function () { | |
gulp.src("playground/src/templates/**.jade") | |
.pipe(jade()) | |
.pipe(gulp.dest("playground")); | |
}); | |
gulp.task("clean-html", function () { | |
gulp.src("playground/*.html", {read: false}).pipe(clean({force: true})); | |
}); | |
/*********************************************************/ | |
/** | |
* Web Server | |
*/ | |
gulp.task("server", function () { | |
connect.server({ | |
livereload: true, | |
root: ["build", "playground"], | |
}); | |
}); | |
gulp.task("livereload", function () { | |
watch(["playground/*.html", "playground/dist/**"]) | |
.pipe(connect.reload()); | |
}); | |
gulp.task("watch", function () { | |
gulp.watch("playground/src/styles/less/*.less", ["less"]); | |
gulp.watch("playground/src/scripts/jsx/*.jsx", ["jsx"]); | |
gulp.watch("playground/src/templates/**.jade", ["jade"]); | |
}); | |
/*********************************************************/ | |
/** | |
* Mixin feature for usages | |
*/ | |
gulp.task("default", ["less", "jsx", "jade", "server", "livereload", "watch"]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment