Skip to content

Instantly share code, notes, and snippets.

@leandrojo
Created December 3, 2015 20:18
Show Gist options
  • Select an option

  • Save leandrojo/816a910ce61dcaf5514f to your computer and use it in GitHub Desktop.

Select an option

Save leandrojo/816a910ce61dcaf5514f to your computer and use it in GitHub Desktop.
gulp = require("gulp")
concat = require("gulp-concat")
shell = require("gulp-shell")
stylus = require("gulp-stylus")
jade = require("gulp-jade")
watch = require("gulp-watch")
preprocess = require("gulp-preprocess")
args = require("yargs").argv
gulp.task "concat:js", () ->
map = [
"./src/app/*.{js}",
"./src/app/**/*.{js}"
]
gulp.src(map)
.pipe(concat("app.js"))
.pipe(preprocess({context: { NODE_ENV: args.production == 1 ? "PRODUCTION" : "DEVELOPMENT"}}))
.pipe(gulp.dest("./www/js"))
gulp.task "compile:stylus", () ->
gulp.src("./src/css/main.styl")
.pipe(stylus())
.pipe(gulp.dest("./www/css"))
gulp.task "compile:jade", () ->
gulp.src("./src/templates/index.jade")
.pipe(jade())
.pipe(gulp.dest("./www"))
gulp.task "watch:js", () ->
gulp.watch [
"./src/app/*.{js}",
"./src/app/**/*.{js}"
], () ->
gulp.start("concat:js")
gulp.task "watch:jade", () ->
gulp.watch [
"./src/templates/**/*.jade",
"./src/templates/index.jade"
], (files) ->
gulp.start("compile:jade")
gulp.task "build", [ "concat:js", "compile:stylus", "compile:jade" ]
gulp.task "watch", [ "build", "watch:js", "watch:stylus", "watch:jade" ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment