-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
75 lines (65 loc) · 2.01 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
var gulp = require('gulp');
var browserSync = require('browser-sync').create();
var $ = require('gulp-load-plugins')();
var conf = {
app: 'app',
src: 'src',
dist: 'dist'
};
gulp.task('browser-sync', function() {
browserSync.init({
port: 54321,
server: {
baseDir: "app",
routes: {
'/bower_components': 'bower_components',
'/dist': 'dist'
},
open: true,
notify: true
}
});
});
gulp.task('scripts:app', function() {
var files = [
conf.app + '/scripts/app.js',
conf.app + '/scripts/controllers/*.js'
];
return gulp.src(files)
.pipe($.plumber())
.pipe($.expectFile.real(files))
.pipe($.concat('app.min.js'))
.pipe(gulp.dest(conf.app + '/scripts/min'))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('scripts:directive', function() {
var files = [
conf.src + '/directives/*.js',
conf.src + '/services/*.js'
];
return gulp.src(files)
.pipe($.plumber())
.pipe($.expectFile.real(files))
.pipe($.concat('angular-leaflet.min.js'))
.pipe($.uglify())
.pipe(gulp.dest(conf.dist))
.pipe(browserSync.reload({
stream: true
}));
});
gulp.task('watch:app', function() {
gulp.watch(conf.app + '/scripts/**/*.js', ['scripts:app']);
gulp.watch(conf.app + '/**/*.html', browserSync.reload);
});
gulp.task('watch:directive', function() {
gulp.watch(conf.src + '/**/*.js', ['scripts:directive']);
gulp.watch(conf.app + '/scripts/**/*.js', ['scripts:app']);
gulp.watch(conf.app + '/**/*.html', browserSync.reload);
});
gulp.task('bower:install', function() {
return $.bower();
});
gulp.task('default', ['browser-sync', 'bower:install', 'scripts:app', 'watch:app'], function() {});
gulp.task('source', ['browser-sync', 'bower:install', 'scripts:directive', 'scripts:app', 'watch:directive', 'watch:app'], function() {});