-
Notifications
You must be signed in to change notification settings - Fork 24
/
Gulpfile.js
41 lines (34 loc) · 971 Bytes
/
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
'use strict';
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
gulp.task('uglify', function() {
return gulp.src([
'./src/*.js',
])
.pipe(plugins.plumber({
errorHandler: handleError
}))
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
.pipe(plugins.sourcemaps.init())
.pipe(plugins.concat('openseadragonselection.js'))
.pipe(plugins.uglify())
.pipe(plugins.sourcemaps.write('./'))
.pipe(gulp.dest('./dist'));
});
gulp.task('watch', ['uglify'], function () {
gulp.watch('./src/*.js', ['uglify']);
});
gulp.task('serve', plugins.serve({
root: ['dist', 'images'],
port: 4040,
}));
gulp.task('default', ['watch', 'serve']);
/**
* Displays error message in the console
* @param error
*/
function handleError(error) {
plugins.util.beep();
plugins.util.log(plugins.util.colors.red(error));
}