-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
58 lines (48 loc) · 1.49 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'),
elm = require('gulp-elm'),
rename = require('gulp-rename'),
concat = require('gulp-concat'); //Concatenates files
var config = {
paths: {
css: [
'node_modules/bootstrap/dist/css/bootstrap.min.css',
'node_modules/bootstrap/dist/css/bootstrap-theme.min.css'
],
js: [
'node_modules/jquery/dist/jquery.min.js',
'node_modules/bootstrap/dist/js/bootstrap.min.js',
'src/js/calculator.js'
],
html: [
'src/Calculator.html'
],
src: 'src',
dest: 'dest'
}
};
gulp.task('elm-init', elm.init);
gulp.task('elm', ['elm-init'], function () {
return gulp.src('./src/Calculator.elm')
.pipe(elm())
.on('error', swallowError)
.pipe(rename('calculator.js'))
.pipe(gulp.dest('./src/js'));
});
gulp.task('copy-js-css-html', function(){
gulp.src(config.paths.css)
.pipe(concat('bundle.css'))
.pipe(gulp.dest(config.paths.dest + '/css'));
gulp.src(config.paths.html)
.pipe(concat('calculator.html'))
.pipe(gulp.dest(config.paths.dest));
return gulp.src(config.paths.js)
.pipe(concat('bundle.js'))
.pipe(gulp.dest(config.paths.dest + '/js'));
});
function swallowError (error) {
console.log(error.toString());
this.emit('end');
}
gulp.task('default', ['elm', 'copy-js-css-html'], function () {
gulp.watch('./src/*.elm', ['elm', 'copy-js-css-html']);
});