forked from CyberMiles/web3-cmt.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
40 lines (35 loc) · 1.04 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
var path = require("path")
var gulp = require("gulp")
var del = require("del")
var browserify = require("browserify")
var exorcist = require("exorcist")
var source = require("vinyl-source-stream")
var streamify = require("gulp-streamify")
var uglify = require("gulp-uglify")
var rename = require("gulp-rename")
var browserifyOptions = {
debug: true,
insert_global_vars: false, // jshint ignore:line
detectGlobals: false,
bundleExternal: true
}
var DEST = path.join(__dirname, "dist/")
var entry_file = "./src/index.js"
var dst = "web3-cmt"
gulp.task("clean", function() {
return del(["dist/**/*"])
})
gulp.task("build", function() {
return browserify(browserifyOptions)
.require(entry_file, { expose: dst })
.require("bignumber.js") // expose it to dapp users
.add(entry_file)
.bundle()
.pipe(exorcist(path.join(DEST, dst + ".js.map")))
.pipe(source(dst + ".js"))
.pipe(gulp.dest(DEST))
.pipe(streamify(uglify()))
.pipe(rename(dst + ".min.js"))
.pipe(gulp.dest(DEST))
})
gulp.task("default", ["clean", "build"])