-
Notifications
You must be signed in to change notification settings - Fork 9
/
gulpfile.coffee
45 lines (37 loc) · 1.21 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
gulp = require 'gulp'
del = require 'del'
zip = require 'gulp-zip'
browserify = require('browserify')
source = require('vinyl-source-stream')
uglify = require('gulp-uglify-es').default
paths =
lib: 'lib/**/*.*'
gulp.task 'copy', ->
gulp.src(paths.lib, { encoding: false })
.pipe(gulp.dest('build'))
gulp.task 'coffee', ->
browserify(
entries: ["src/js/esarea.coffee"]
extensions: ['.coffee']
)
.transform('coffeeify')
.bundle()
.pipe source 'bundle.js'
.pipe gulp.dest 'build/js'
gulp.task 'compress', (cb) ->
gulp.src("build/js/bundle.js")
.pipe(uglify())
.pipe(gulp.dest("build/js"))
gulp.task 'watch', ->
gulp.watch paths.lib, gulp.series('copy')
gulp.watch "src/js/esarea.coffee", gulp.series('coffee', 'compress')
gulp.task 'clean', (cb)->
del(['build', 'build.zip'], cb);
gulp.task 'zip', ->
gulp.src('build/**/*.*', { encoding: false })
.pipe(zip('build.zip'))
.pipe(gulp.dest('./'))
gulp.task 'build', gulp.series(gulp.parallel('copy', 'coffee'), 'compress')
gulp.task 'rebuild', gulp.series('clean', 'build')
gulp.task 'release', gulp.series('clean', 'build', 'zip')
gulp.task 'default', gulp.series('clean', 'build', 'watch')