building and minifying dist bundle
Some checks failed
default/mapgen/master There was a failure building this commit

This commit is contained in:
Alexander Yakovlev 2018-09-22 22:23:32 +07:00
parent 6b81f62b60
commit 43462dff6e

View file

@ -28,6 +28,23 @@ bundler = watchify(browserify({
transform: [coffeify]
}))
gulp.task('bundle-dist', () ->
return browserify({
entries: ["./build/game/main.coffee"]
debug: true
transform: [coffeify]
})
.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
.pipe(source('bundle.js'))
.pipe(gulp.dest('./build/game'))
)
gulp.task('minify-dist', () ->
return gulp.src(['./build/game/bundle.js'])
.pipe(minify())
.pipe(gulp.dest('./dist/game/'))
)
bundle = () ->
return bundler.bundle()
.on('error', gutil.log.bind(gutil, 'Browserify Error'))
@ -186,29 +203,28 @@ gulp.task('sass-dist', () ->
.pipe(gulp.dest('./dist/css'))
)
gulp.task('bundle-dist', () ->
return gulp.src('./build/game/main.coffee', {sourcemaps: false})
.pipe(coffee())
.pipe(minify())
.on('error', gutil.log)
.pipe(gulp.dest('./dist/game/'))
)
gulp.task('remove-big-bundle-dist', () ->
gulp.task('remove-big-bundle-dist', (done) ->
return gulp.src([
'./dist/game/main.js'
'./dist/game/main-min.js'
'./dist/game/bundle-min.js'
])
.pipe(rm())
.on('end', () -> done())
)
gulp.task('rename-min-bundle-dist', (done) ->
return gulp.src([
'./dist/game/bundle-min.js'
])
.pipe(rename('bundle.js'))
.pipe(gulp.dest('./dist/game/'))
.on('end', () -> done())
)
gulp.task('coffee-dist', gulp.series(
'concatCoffee'
'bundle-dist'
() ->
return gulp.src(['./dist/game/main-min.js'])
.pipe(rename('bundle.js'))
.pipe(gulp.dest('./dist/game/'))
'minify-dist'
'rename-min-bundle-dist'
'remove-big-bundle-dist'
)
)