-
Notifications
You must be signed in to change notification settings - Fork 13
/
gulpfile.js
24 lines (17 loc) · 787 Bytes
/
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
const gulp = require('gulp')
const browserify = require('browserify')
const uglify = require('gulp-uglify-es').default
const source = require('vinyl-source-stream')
const streamify = require('gulp-streamify')
const rename = require('gulp-rename')
const buildScripts = () => {
const getSourceScript = () => browserify('./src/index.js', { standalone: 'Game' }).bundle().pipe(source('index.js'))
const transformScript = (source) => source.pipe(rename('index.min.js')).pipe(streamify(uglify()))
const setDestination = (source) => source.pipe(gulp.dest('./dist/'))
setDestination(transformScript(getSourceScript()))
setDestination(getSourceScript())
}
gulp.task('build', buildScripts)
gulp.task('watch', () => {
return gulp.watch('./src/**/*.js', ['build'])
})