-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
46 lines (40 loc) · 1.4 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
const gulp = require('gulp');
const browserify = require('browserify');
const source = require('vinyl-source-stream');
const watchify = require('watchify');
const tsify = require('tsify');
const fancy_log = require('fancy-log');
const uglify = require('gulp-uglify');
const sourcemaps = require('gulp-sourcemaps');
const buffer = require('vinyl-buffer');
const paths = {
files: ['src/ajax/*.*', 'src/connectors/*.*', 'src/lib/*?/*.*', 'src/templates/*.*', 'src/icons/fonts/*.*', 'src/icons/style.css']
};
const watchedBrowserify = watchify(browserify({
basedir: '.',
debug: true,
entries: ['src/ts/file-tree-browser.ts'],
cache: {},
packageCache: {}
}).plugin(tsify));
function bundle () {
return watchedBrowserify
/* .transform('babelify', {
presets: ['es2015'],
extensions: ['.ts']
}) */
.bundle()
.on('error', fancy_log)
.pipe(source('js/file-tree-browser.js'))
.pipe(buffer())
.pipe(sourcemaps.init({ loadMaps: true }))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('dist'));
}
gulp.task('copy-files', function () {
return gulp.src(paths.files, { base: 'src' })
.pipe(gulp.dest('dist/'));
});
gulp.task('default', gulp.series(gulp.parallel('copy-files'), bundle));
watchedBrowserify.on('update', gulp.series(gulp.parallel('copy-files'), bundle));
watchedBrowserify.on('log', fancy_log);