-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.coffee
56 lines (49 loc) · 1.39 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
gulp = require 'gulp'
sequence = require 'run-sequence'
exec = require('child_process').exec
env =
dev: true
main: 'http://localhost:8080/build/main.js'
vendor: 'http://localhost:8080/build/vendor.js'
gulp.task 'rsync', (cb) ->
wrapper = require 'rsyncwrapper'
wrapper.rsync
ssh: true
src: ['index.html', 'build', 'images']
recursive: true
args: ['--verbose']
dest: 'talk-ui:/teambition/server/talk-ui/volubile-ui'
deleteAll: true
, (error, stdout, stderr, cmd) ->
if error?
throw error
console.error stderr
console.log cmd
cb()
gulp.task 'html', (cb) ->
require 'cirru-script/lib/register'
html = require './template'
fs = require 'fs'
if (not env.dev)
assets = require './build/assets.json'
env.main = "./build/#{assets.main}"
env.vendor = "./build/#{assets.vendor}"
fs.writeFile 'index.html', (html env), cb
gulp.task 'del', (cb) ->
del = require 'del'
del ['build'], cb
gulp.task 'webpack', (cb) ->
command = if env.dev then 'webpack' else 'webpack --config webpack.min.coffee --progress'
exec command, (err, stdout, stderr) ->
console.log stdout
console.log stderr
cb err
gulp.task 'script', ->
coffee = require('gulp-coffee')
gulp
.src 'src/components/*.coffee'
.pipe coffee({bare: true})
.pipe gulp.dest('lib/')
gulp.task 'build', (cb) ->
env.dev = false
sequence 'del', 'webpack', 'html', cb