-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
90 lines (73 loc) · 1.94 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
81
82
83
84
85
86
87
88
89
90
var gulp = require('gulp');
var paths = {
src: 'src/**/*.js',
spec: 'spec/**/*-spec.js',
build: 'dist/slang.min.js'
}
/*
*
* Build process (concat and minify)
*
*/
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
function slangTask(slang) {
return gulp.src(['src/' + slang + '/**/*.js'])
.pipe(concat('' + slang + '.js'))
.pipe(gulp.dest('dist/' + slang + '/'))
.pipe(uglify())
.pipe(rename('' + slang + '.min.js'))
.pipe(gulp.dest('dist/' + slang + '/'));
}
gulp.task('mathslang', function() {
return slangTask('mathslang');
});
gulp.task('colorslang', function() {
return slangTask('colorslang');
});
gulp.task('hausdorffslang', function() {
return slangTask('hausdorffslang');
});
gulp.task('langslang', function() {
return slangTask('langslang');
});
gulp.task('logicslang', function() {
return slangTask('logicslang');
});
gulp.task('build', ['mathslang', 'colorslang', 'hausdorffslang', 'langslang', 'logicslang'], function() {
return gulp.src(['dist/**/*.js', '!dist/**/*min.js', '!dist/slang.js', '!dist/slang.min.js'])
.pipe(concat('slang.js'))
.pipe(gulp.dest('dist/'))
.pipe(uglify({
compress: {
drop_console: true,
booleans: true,
sequences: true,
dead_code: true,
loops: true
}
}))
.pipe(rename('slang.min.js'))
.pipe(gulp.dest('dist/'));
});
/*
*
* Test
*
*/
var jasmine = new require('gulp-jasmine-livereload-task');
gulp.task('default', function() {
gulp.run(jasmine({
files: [paths.src, paths.spec]
}));
});
gulp.task('watch', function() {
gulp.run('build');
gulp.watch(paths.src, ['build']);
});
gulp.task('test-build', ['watch'], function() {
gulp.run(jasmine({
files: [paths.build, paths.spec]
}));
});