forked from slively/ng-context-menu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
55 lines (45 loc) · 1.21 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
var gulp = require('gulp'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify'),
jshint = require('gulp-jshint'),
rename = require('gulp-rename'),
connect = require('gulp-connect'),
debug = false;
gulp.task('lint', function () {
gulp.src('src/**/*.js')
.pipe(jshint())
.pipe(jshint.reporter('default'));
});
gulp.task('js', function() {
var jsTask = gulp.src('src/**/*.js')
.pipe(concat('ng-context-menu.js'))
.pipe(gulp.dest('dist'));
if (!debug) {
jsTask.pipe(uglify());
}
jsTask
.pipe(rename('ng-context-menu.min.js'))
.pipe(gulp.dest('dist'))
.pipe(connect.reload());
});
gulp.task('connect', function() {
gulp.watch(['index.html'], function() {
gulp.src(['index.html'])
.pipe(connect.reload());
});
connect.server({
livereload: true
});
});
gulp.task('debug', function() {
debug = true;
});
function changeNotification(event) {
console.log('File', event.path, 'was', event.type, ', running tasks...');
}
function build() {
var jsWatcher = gulp.watch('src/**/*.js', ['js', 'lint']);
jsWatcher.on('change', changeNotification);
}
gulp.task('default', ['js', 'lint'], build);
gulp.task('server', ['connect', 'default']);