-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.coffee
49 lines (41 loc) · 1.32 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
coffee = require('gulp-coffee')
gulp = require('gulp')
gutil = require('gulp-util')
sourcemaps = require('gulp-sourcemaps')
del = require('del')
nodemon = require('gulp-nodemon')
sass = require('gulp-sass')
paths =
coffeeClient: './client/js/src/*.coffee'
jsClient: './client/js/build/'
sassSrc: './client/css/src/*.scss'
sassSrcWatch: './client/css/src/**/*.scss'
cssBuild: './client/css/build/'
gulp.task 'coffee-client', ['clean-js'], ->
gulp.src(paths.coffeeClient)
.pipe(sourcemaps.init())
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(sourcemaps.write('./maps/'))
.pipe(gulp.dest(paths.jsClient))
gulp.task 'watch', ['coffee-client', 'sass'], ->
gulp.watch(paths.coffeeClient, ['coffee-client'])
gulp.watch(paths.sassSrcWatch, ['sass'])
gulp.task 'clean-js', (cb) ->
del([paths.jsClient], cb)
gulp.task 'clean-css', (cb) ->
del([paths.cssBuild], cb)
gulp.task 'nodemon', ->
nodemon(
script: 'app.coffee'
ext: 'coffee js'
watch: ['setup/', 'modules/', 'models/', 'middleware/', 'config/', 'app.coffee']
).on 'restart', ->
gutil.log('app restarted')
gulp.task('dev', ['nodemon', 'watch'])
gulp.task('build', ['coffee-client', 'sass'])
gulp.task 'sass', ['clean-css'], ->
gulp.src(paths.sassSrc)
.pipe(sass({
sourceComments: 'map'
})).on('error', gutil.log)
.pipe(gulp.dest(paths.cssBuild))