forked from maptalks/maptalks.gridlayer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (35 loc) · 1.1 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
'use strict';
var path = require('path'),
gulp = require('gulp'),
gzip = require('gulp-gzip'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
// mocha = require('gulp-mocha'),
Server = require('karma').Server;
var mainjs = './maptalks.gridlayer.js';
gulp.task('scripts', function () {
return gulp.src(mainjs)
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest('./'))
.pipe(gzip())
.pipe(gulp.dest('./'));
});
gulp.task('watch', ['test'], function () {
gulp.watch(['src/**/*.js', 'test/**/*.js', './gulpfile.js'], ['test']);
});
var karmaConfig = {
configFile: path.join(__dirname, '/karma.conf.js'),
browsers: ['PhantomJS'],
singleRun: false
};
gulp.task('test', [], function (done) {
// gulp.src(['./node_modules/maptalks/dist/maptalks.js', mainjs, 'test/*.js'], {read: false})
// .pipe(mocha());
karmaConfig.singleRun = true;
new Server(karmaConfig, done).start();
});
gulp.task('tdd', [], function (done) {
new Server(karmaConfig, done).start();
});
gulp.task('default', ['watch']);