-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathgulpfile.js
56 lines (48 loc) · 1.22 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 uglify = require('gulp-uglify');
var ngAnnotate = require('gulp-ng-annotate');
var rename = require('gulp-rename');
var connect = require('gulp-connect');
var livereload = require('gulp-livereload');
var open = require('gulp-open');
var jshint = require('gulp-jshint');
var paths = {
scripts: [
'./ngBootbox.js',
'./examples/**/*.js',
'!./examples/**/require.js'
]
};
var port = 8181;
gulp.task('default', ['dist']);
gulp.task('dist', function() {
gulp.src('ngBootbox.js')
.pipe(ngAnnotate())
.pipe(gulp.dest('dist'))
.pipe(uglify())
.pipe(rename({ extname: '.min.js' }))
.pipe(gulp.dest('dist'))
});
gulp.task('scripts', function() {
gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(connect.reload());
})
gulp.task('webserver', function() {
connect.server({
port: port,
livereload: true
});
});
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
});
gulp.task('open', ['webserver'], function() {
var options = {
url: 'http://localhost:' + port + '/examples/index.html'
};
gulp.src('./examples/index.html')
.pipe(open('', options));
});
gulp.task('serve', ['watch', 'open']);