gulpfile.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. var del = require('del')
  3. var gulp = require("gulp");
  4. var coffee = require("gulp-coffee");
  5. var sass = require("gulp-sass");
  6. // clean task
  7. gulp.task("clean", function () {
  8. return del(["src/static/coffee/**/*.coffee", "src/static/js/**/*.js"]);
  9. });
  10. // coffee task
  11. gulp.task("coffee", function () {
  12. return gulp.src("./static/src/coffee/*.coffee")
  13. .pipe(coffee())
  14. .pipe(gulp.dest("./static/src/js"));
  15. });
  16. // coffee watch task
  17. gulp.task("coffee:watch", function () {
  18. return gulp.watch("./static/src/coffee/*.coffee", ["clean", "coffee"]);
  19. });
  20. // sass task
  21. gulp.task("sass", function () {
  22. return gulp.src("./static/src/sass/**/*.sass")
  23. .pipe(sass({
  24. indentedSyntax: true,
  25. indentType: "tab",
  26. indentWidth: 1,
  27. outputStyle: "expanded"
  28. }).on("error", sass.logError))
  29. .pipe(gulp.dest("./static/src/css"));
  30. });
  31. // sass watch task
  32. gulp.task("sass:watch", function () {
  33. return gulp.watch("./static/src/sass/**/*.sass", ["clean", "sass"]);
  34. });
  35. // sass default tasks
  36. gulp.task("default", ["coffee", "sass"]);
  37. gulp.task("default:watch", ["coffee:watch", "sass:watch"]);