-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.coffee
84 lines (68 loc) · 2.38 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
# Lint disabled due to react jsx
gulp = require "gulp"
gutil = require "gulp-util"
karma = require("karma").server
$ = require('gulp-load-plugins')()
express = require 'express'
gulp.task 'scripts', ->
return gulp.src('src/client/app.coffee', { read: false })
.pipe($.browserify({
transform: ['coffee-reactify'],
extensions: ['.coffee']
})).on("error", gutil.log).on("error", gutil.beep)
.pipe($.rename('app.js'))
.pipe(gulp.dest('./public'))
.pipe($.livereload())
gulp.task 'tests', ->
return gulp.src('src/tests/test.coffee', { read: false })
.pipe($.browserify({
transform: ['coffeeify'],
extensions: ['.coffee']
})).on("error", gutil.log).on("error", gutil.beep)
.pipe $.rename 'tests.js'
.pipe gulp.dest './gen'
gulp.task "styles", ->
return gulp.src(["./src/**/*.scss"])
.pipe($.concat("app.css"))
.pipe($.sass(errLogToConsole: true).on("error", gutil.log).on("error", gutil.beep))
.pipe(gulp.dest("./public"))
.pipe($.livereload())
gulp.task "jade", ->
return gulp.src("./src/jade/index.jade")
.pipe($.jade().on("error", gutil.log).on("error", gutil.beep))
.pipe gulp.dest("./public")
.pipe $.livereload()
gulp.task "clean", ->
gulp.src(["./public", "./gen"])
.pipe $.clean()
gulp.task "assets", ->
gulp.src "./src/assets/**/*"
.pipe gulp.dest("./public")
.pipe $.livereload()
gulp.task "lint", ->
return gulp.src(["src/**/*.coffee"])
.pipe($.coffeelint())
.pipe($.coffeelint.reporter())
.pipe($.coffeelint.reporter('fail'))
.on("error", gutil.beep)
karmaCommonConf =
browsers: ['Chrome']
frameworks: ['mocha']
files: [
'gen/tests.js',
]
reporters: ['mocha', 'beep'],
gulp.task "tdd", (done) ->
karma.start karmaCommonConf, done
gulp.task "default", ["scripts", "tests", "styles", "jade", "assets"], ->
app = express()
app.use require('connect-livereload')()
app.use express.static "#{__dirname}/public"
$.livereload.listen()
port = 8765
gutil.log gutil.colors.cyan "=== Listening on port #{port}. ==="
app.listen port
gulp.watch("src/**/*.coffee", ["scripts", "tests"])
gulp.watch("src/**/*.scss", ["styles"])
gulp.watch("src/**/*.jade", ["jade"])
gulp.watch("src/assets/**/*", ["assets"])