-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gulpfile.coffee
107 lines (74 loc) · 2.4 KB
/
Gulpfile.coffee
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
gulp = require "gulp"
jshint = require "gulp-jshint"
livereload = require "gulp-livereload"
nodemon = require "gulp-nodemon"
fs = require "fs"
stylus = require "gulp-stylus"
watch = require "gulp-watch"
require "colors"
# --- TODO: ---------------------------
# uglify = require "gulp-uglify"
# concat = require "gulp-concat"
# beautify = require "gulp-js-beautify"
# concat = require "gulp-concat"
# rename = require "gulp-rename"
# uglify = require "gulp-uglify"
# filter = require "gulp-filter"
minifyCSS = require "gulp-minify-css"
jsFiles = ["./client/**/*.js", "./server/**/*.js", "./scripts/updateUsers.js"]
stylusFiles = ["./client/stylus/**/*.styl"]
stylusMain = ["./client/stylus/main.styl"]
# jsDist = "./client/public/assets/js/"
cssDist = "./client/public/assets/css/"
cssFiles = cssDist + "*.css"
htmlFiles = "./client/public/views/**/*.html"
## --- JavaScript
## ------------------
gulp.task "scripts", ->
console.log "Linting".underline.cyan, "JS".black.bgYellow
gulp.src jsFiles
.pipe jshint()
.pipe jshint.reporter "default"
.pipe jshint.reporter "fail"
.pipe livereload()
## --- Stylesheets
## ------------------
gulp.task "stylesheets", ->
console.log "Compiling".underline.cyan, "Stylus".bgGreen
gulp.src stylusMain
.pipe stylus()
.pipe gulp.dest cssDist
.pipe livereload()
gulp.task "minify", ->
gulp.src cssFiles
.pipe minifyCSS()
.pipe gulp.dest cssDist
gulp.task "html", ->
gulp.src htmlFiles
.pipe livereload()
## --- Server
## ------------------
gulp.task "server", ->
livereload.listen()
options =
script: "server/server.js"
ext: "js"
watch: "server/**/*.js"
nodemon options
.on "start", ->
console.log "--------".america, "STARTED NODEMON!".green, "--------".america
.on "restart", ->
console.log "--------".america, "RESTARTED NODEMON!".green, "--------".america
## --- Watch
## ------------------
gulp.task "watch", ->
console.log "Watching".underline.cyan, "Stylus".bgGreen
gulp.watch stylusFiles, ["stylesheets"]
console.log "Watching".underline.cyan, "JS".black.bgYellow
gulp.watch jsFiles, ["scripts"]
console.log "Watching".underline.cyan, "HTML".black.bgYellow
gulp.watch htmlFiles, ["html"]
## ------------------
## ---- TASKS -----
## ------------------
gulp.task "default", ["scripts", "stylesheets", "server", "watch"]