-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gulpfile.js
80 lines (67 loc) · 1.95 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var gulp = require('gulp');
var liveServer = require('live-server');
var $ = require('gulp-load-plugins')({});
var del = require('del');
function watchElmAndRun(...args) {
return gulp.watch('**/*.elm', args);
}
gulp.task('build', function() {
return gulp.src('src/App.elm')
.pipe($.plumber({
errorHandler: $.notify.onError({ sound: false, message: 'Elm error' })
}))
.pipe($.elm.bundle('App.js', {
warn: true,
debug: true
}))
.pipe(gulp.dest('build/'));
});
gulp.task('prod:elm', ['prod:clean'], function() {
return gulp.src('src/App.elm')
.pipe($.elm.bundle('App.js'))
.pipe($.uglify())
.pipe(gulp.dest('dist/build'));
});
gulp.task('prod:clean', function() {
return del(['dist/**/*']);
});
gulp.task('prod:vendor', ['prod:clean'], function() {
return gulp.src('vendor/*').pipe(gulp.dest('dist/vendor'));
});
gulp.task('prod:html', ['prod:clean'], function() {
return gulp.src('index.html')
.pipe($.rename('200.html'))
.pipe(gulp.dest('dist'));
});
gulp.task('prod:css', ['prod:clean'], function() {
return gulp.src('style.css').pipe(gulp.dest('dist'));
});
gulp.task('prod:img', ['prod:clean'], function() {
return gulp.src('img/*').pipe(gulp.dest('dist/img'));
});
gulp.task('prod:js', ['prod:clean'], function() {
return gulp.src('js/*').pipe(gulp.dest('dist/js'));
});
gulp.task('prod:content', ['prod:clean'], function() {
return gulp.src('content/**/*', { base: 'content' }).pipe(gulp.dest('dist/content'));
});
gulp.task('deploy', [
'prod:vendor', 'prod:html', 'prod:css',
'prod:js', 'prod:img', 'prod:content', 'prod:elm'
], function() {
$.util.log('Deploying version: ', require('./package.json').version);
return $.surge({
project: './dist',
domain: 'elmplayground.com'
});
});
gulp.task('start', ['build'], function() {
watchElmAndRun('build');
});
gulp.task('serve', function() {
liveServer.start({
open: false,
ignore: /elm-stuff/,
file: 'index.html'
});
});