forked from njibhu/Tyria3DLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
59 lines (51 loc) · 1.53 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
'use strict';
//Load version from package.json
const version = require('./package.json').version;
/* Gulp modules and requires */
const browserify = require('browserify');
const gulp = require('gulp');
const source = require('vinyl-source-stream');
const buffer = require('vinyl-buffer');
const sourcemaps = require('gulp-sourcemaps');
const log = require('gulplog');
const uglifyjs = require('uglify-es');
const composer = require('gulp-uglify/composer');
const uglify = composer(uglifyjs, console);
const watch = require('gulp-watch');
gulp.task('T3D', function(){
// set up the browserify instance on a task basis
let b = browserify({
entries: './src/T3DLib.js',
debug: true,
standalone: 'T3D'
});
return b.bundle()
.pipe(source(`T3D-${version}.js`))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
// Add transformation tasks to the pipeline here.
.pipe(uglify())
.on('error', log.error)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('build'))
.pipe(gulp.dest('./examples/static'));
});
gulp.task('formats', function(){
let b = browserify({
entries: './src/format/chunks/AllFormats.js',
debug: true,
});
return b.bundle()
.pipe(source(`T3D-${version}.Formats.js`))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(uglify())
.on('error', log.error)
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('build'))
.pipe(gulp.dest('./examples/static'));
})
gulp.task('watch', function() {
gulp.watch(['src/**/*.js'], gulp.series('T3D'));
});
gulp.task('default', gulp.series('T3D'));