-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
56 lines (50 loc) · 1.35 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
var gulp = require('gulp');
var rename = require('gulp-rename');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var eslint = require('gulp-eslint');
var uglify = require('gulp-uglify');
var jasmine = require('gulp-jasmine');
var paths = {
main_js: ['js/vertex.js'],
js: ['js/*.js']
};
gulp.task('lint', function() {
return gulp.src('js/**/*.js')
.pipe(eslint({
rules: {
'strict': 2
},
}))
.pipe(eslint.format())
.pipe(eslint.failOnError());
});
gulp.task('build', ['lint'], function() {
var b = browserify({
paths: [
__dirname + '/js'
],
debug: true
});
b.add(__dirname + '/js/cleaver.js');
b.bundle()
.on('error', function(error) {
console.log(error.message);
this.emit('end');
})
.pipe(source('cleaver.js'))
.pipe(gulp.dest('./build/'))
.pipe(rename('cleaver.min.js'))
.pipe(streamify(uglify()))
.pipe(gulp.dest('./build/'));
});
gulp.task('test', ['build'], function() {
return gulp.src('test/**/*-test.js')
.pipe(jasmine({ verbose: true }));
});
gulp.task('copy', ['test'], function() {
gulp.src('html/**/*').pipe(gulp.dest('build/'));
});
// Default Task
gulp.task('default', ['lint', 'build', 'test', 'copy']);