forked from tmijs/tmi.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
34 lines (29 loc) · 1.03 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
var gulp = require("gulp");
var sourcemaps = require("gulp-sourcemaps");
var source = require("vinyl-source-stream");
var buffer = require("vinyl-buffer");
var browserify = require("browserify");
var uglify = require("gulp-uglify");
var glob = require("glob");
var babel = require("babelify");
var size = require("gulp-size");
function compile(done) {
glob("lib/*.js", function(err, files) {
if (err) { done(err); }
files.push("index.js");
var bundler = browserify(files, { debug: true }).transform(babel);
function rebundle() {
bundler.bundle()
.on("error", function(err) { console.error(err); this.emit("end"); })
.pipe(source("tmi.js"))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(uglify())
.pipe(sourcemaps.write("./"))
.pipe(gulp.dest("./dist"))
.pipe(size({ showFiles: true }));
}
rebundle();
});
}
gulp.task("default", function() { return compile(); });