-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
69 lines (55 loc) · 1.57 KB
/
gulpfile.js
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
let fs = require('fs')
let gulp = require("gulp")
let babel = require('gulp-babel')
let rename = require('gulp-rename')
let concat = require('gulp-concat')
let browserify = require("browserify")
let path = require('path')
let plumber = require('gulp-plumber')
gulp.task('clean', function () {
del.sync(['build/*'])
return del.sync(['bin/*'])
})
gulp.task('dump', ['clean'], function (callback) {
gulp.src("vendor/**/*")
.pipe(gulp.dest('./build/vendor'))
return callback()
})
gulp.task('babel', function () {
return gulp.src('src/**/*.js')
.pipe(plumber())
.pipe(babel({
presets: ['es2015'],
plugins: ['transform-runtime']
}))
.pipe(gulp.dest('./build'))
})
gulp.task('weex', ['babel'], function () {
return gulp.src('./build/index.js')
.pipe(wrap("#!/usr/bin/env node \n\n<%= contents %>"))
.pipe(gulp.dest('./bin'))
})
gulp.task('browserify', ['babel'], function (callback) {
browserify("./build/debugger-client.js", {debug: false})
.bundle()
.pipe(source('debugger-client-browserify.js')) //vinyl-source-stream
.pipe(gulp.dest('./build/'))
return callback()
})
gulp.task('less', function (callback) {
gulp.src('./src/css/**/*.less')
.pipe(less({
paths: [path.join(__dirname, 'src/css/', 'includes')]
}))
.pipe(gulp.dest('./build/css'))
gulp.src('./src/css/**/*.css')
.pipe(gulp.dest('./build/css'))
return callback()
})
gulp.task('build', ['browserify'], function (cb) {
return cb()
})
gulp.task('watch', function () {
gulp.watch('src/**/*.js', ['build'])
})
gulp.task('default', ['watch'])