-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.coffee
63 lines (44 loc) · 1.38 KB
/
gulpfile.coffee
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
60
61
62
63
gulp = require('gulp')
concat = require('gulp-concat')
cssmin = require('gulp-cssmin')
gulpif = require('gulp-if')
jshint = require("gulp-jshint")
del = require('del')
minifyHTML = require('gulp-minify-html')
uglify = require('gulp-uglify')
useref = require('gulp-useref');
zip = require('gulp-zip');
gulp.task 'app-del-js', ->
del(['app/js/all.js'])
gulp.task 'app-concat-js', ['app-del-js'], ->
gulp.src('app/js/*.js')
.pipe(concat('js/all.js'))
.pipe(gulp.dest('app'))
gulp.task 'minify-js', ['app-del-js'], ->
gulp.src('app/js/*.js')
.pipe(uglify())
.pipe(concat('js/all.js'))
.pipe(gulp.dest('dist'))
gulp.task 'process-html', ->
assets = useref.assets();
gulp.src('app/index.html')
.pipe(assets)
#.pipe(gulpif('*.js', uglify()))
.pipe(gulpif('*.css', cssmin()))
.pipe(assets.restore())
.pipe(useref())
.pipe(minifyHTML())
.pipe(gulp.dest('dist'))
gulp.task 'copy-img', ->
gulp.src('app/img/*')
.pipe(gulp.dest('dist/img/'))
gulp.task 'build', ['minify-js', 'process-html', 'copy-img'], ->
gulp.task 'zip', ['build'], ->
gulp.src('dist/**')
.pipe(zip('game.zip'))
.pipe(gulp.dest('.'));
gulp.task 'default', ['zip']
gulp.task 'jshint', ->
return gulp.src('app/js/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'))