-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
48 lines (41 loc) · 1.03 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
var gulp = require('gulp');
var elm = require('gulp-elm');
var gutil = require('gulp-util');
var plumber = require('gulp-plumber');
var connect = require('gulp-connect');
// File paths
var paths = {
dest: 'dist',
elm: 'src/*.elm',
static: 'src/*.{html,css}'
};
// Init Elm
gulp.task('elm-init', elm.init);
// Compile Elm to HTML
gulp.task('elm', ['elm-init'], function(){
return gulp.src(paths.elm)
.pipe(plumber())
.pipe(elm())
.pipe(gulp.dest(paths.dest));
});
// Move static assets to dist
gulp.task('static', function() {
return gulp.src(paths.static)
.pipe(plumber())
.pipe(gulp.dest(paths.dest));
});
// Watch for changes and compile
gulp.task('watch', function() {
gulp.watch(paths.elm, ['elm']);
gulp.watch(paths.static, ['static']);
});
// Local server
gulp.task('connect', function() {
connect.server({
root: 'dist',
port: 3000
});
});
// Main gulp tasks
gulp.task('build', ['elm', 'static']);
gulp.task('default', ['connect', 'build', 'watch']);