-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
33 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
const browserify = require('browserify');
const gulp = require('gulp');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const uglify = require('gulp-uglify-es').default;
const gutil = require('gulp-util');
const sourcemaps = require('gulp-sourcemaps');
const babelify = require('babelify');
const es2015presets = require('babel-preset-es2015');
gulp.task('build', function () {
// set up the browserify instance on a task basis
const c = browserify({
entries: './dist/lib/index.js',
debug: true,
transform: [babelify.configure({
extensions: ['.ts', '.js'],
presets: [ es2015presets ]
})]
});
return c.bundle()
.pipe(source('../bundle/zoom.min.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
// Add transformation tasks to the pipeline here
.pipe(uglify())
.on('error', gutil.log)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./dist/bundle'));
});