-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
38 lines (33 loc) · 1.01 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var gzip = require('gulp-gzip');
var tar = require('gulp-tar');
var replace = require('gulp-replace');
var zip = require('gulp-zip');
gulp.task('concat', function() {
return gulp.src(['src/classes.js', 'src/statics.js', 'src/ui.js', 'src/index.js'])
.pipe(replace('global.', ''))
.pipe(replace('CHAR_WIDTH', 'cw'))
.pipe(replace('CHAR_HEIGHT', 'ch'))
.pipe(concat('game.min.js'))
.pipe(uglify())
.pipe(gulp.dest('./'));
});
gulp.task('gzip', function() {
gulp.src(['index.html', 'game.min.js'])
.pipe(gzip())
.pipe(gulp.dest('./dist.gz'));
});
gulp.task('tar', function() {
return gulp.src(['dist.html', 'game.min.js'])
.pipe(tar('dist.tar'))
.pipe(gzip())
.pipe(gulp.dest('./'));
});
gulp.task('zip', ['concat'], function() {
return gulp.src(['./dist.html', './game.min.js'])
.pipe(zip('dist.zip'))
.pipe(gulp.dest('./'));
});
gulp.task('compress', ['concat', 'zip']);