-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (47 loc) · 1.48 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
var gulp = require('gulp');
var jshint = require('gulp-jshint');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var elm = require('gulp-elm');
var concat = require('gulp-concat-util');
var ghPages = require('gulp-gh-pages');
var serve = require('gulp-serve');
gulp.task('elm-init', elm.init);
gulp.task('elm-make', ['elm-init'], function(){
return gulp.src('src/Main.elm')
.pipe(elm.make({filetype: 'js'}))
.pipe(gulp.dest('build'));
});
gulp.task('lint', function() {
return gulp.src('src/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('prepare-js', ['lint', 'elm-make'], function() {
return gulp.src(['build/*.js', 'src/*.js'])
.pipe(concat('simonsays.js'))
.pipe(rename('simonsays.min.js'))
.pipe(uglify())
.pipe(gulp.dest('build/dist/js'));
});
gulp.task('prepare-html', function() {
return gulp.src(['src/*.html'])
.pipe(gulp.dest('build/dist'));
});
gulp.task('prepare-sound', function() {
return gulp.src(['sound/*.wav'])
.pipe(gulp.dest('build/dist/sound'));
});
gulp.task('build', ['prepare-js', 'prepare-html', 'prepare-sound']);
gulp.task('watch', ['build'], function() {
gulp.watch('src/*.elm', ['build']);
gulp.watch('src/*.js', ['build']);
gulp.watch('src/*.html', ['build']);
});
gulp.task('serve', serve('build/dist'));
gulp.task('deploy', function() {
gulp.src('build/dist/**/*')
.pipe(ghPages());
});
gulp.task('default', ['build']);