-
Notifications
You must be signed in to change notification settings - Fork 8
/
gulpfile.coffee
79 lines (68 loc) · 1.8 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
'use strict'
gulp = require 'gulp'
del = require 'del'
notify = require 'gulp-notify'
zip = require 'gulp-zip'
sass = require 'gulp-sass'
coffee = require 'gulp-coffee'
jade = require 'gulp-jade'
plumber = require 'gulp-plumber'
runSeq = require 'run-sequence'
shell = require 'shelljs'
changed = require 'gulp-changed'
baseDir = './app'
preparation = [
'./app/js/libs/**/*'
'./app/css/vendor/**/*'
'./app/manifest.json'
]
gulp.task 'jade', ->
gulp.src './app/jade/**/*.jade'
.pipe changed('./build')
.pipe plumber()
.pipe jade()
.pipe gulp.dest('./build/')
.pipe notify('jade: <%= file.relative %>')
gulp.task 'coffee', ->
gulp.src './app/coffee/**/*.coffee'
.pipe changed('./build')
.pipe plumber()
.pipe coffee()
.pipe gulp.dest('./build/js/')
.pipe notify('coffee: <%= file.relative %>')
gulp.task 'prepare', ->
shell.rm('-rf', ['build', 'dist'])
gulp.src preparation, {base: './app'}
.pipe gulp.dest('./build/')
.pipe notify('preparation: <%= file.relative %>')
gulp.task 'sass', ->
gulp.src './app/sass/**/*.sass'
.pipe changed('./build')
.pipe plumber()
.pipe sass
errLogToConsole: true
.pipe gulp.dest('./build/css/')
.pipe notify('sass: <%= file.relative %>')
gulp.task 'build', ['jade', 'coffee', 'sass']
gulp.task 'pack', ->
manifest = require './app/manifest'
fn = "#{manifest.name}.v#{manifest.version}.zip"
gulp.src 'build/**'
.pipe zip fn
.pipe gulp.dest 'dist'
gulp.task 'watch', ->
gulp.watch preparation, ['prepare']
gulp.watch './app/coffee/**/*.coffee', ['coffee']
gulp.watch './app/sass/**/*.sass', ['sass']
gulp.watch './app/jade/**/*.jade', ['jade']
gulp.task 'release', ->
runSeq(
'prepare',
'build',
'pack'
)
gulp.task 'dev', ->
runSeq(
'prepare',
['build', 'watch']
)