-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
105 lines (89 loc) · 2.13 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* gulpfile (task runner)
*/
var gulp = require('gulp')
, concat = require('gulp-concat')
, uglify = require('gulp-uglify')
, jshint = require('gulp-jshint')
, watch = require('gulp-watch')
, rename = require('gulp-rename')
, connect = require('gulp-connect')
, templateCache = require('gulp-angular-templatecache');
/**
* run jshint/lint on all of our non-library files
*/
gulp.task('js-hint', function () {
return gulp.src('./src/**/*.js')
.pipe(watch(function(files) {
return files
.pipe(jshint())
.pipe(jshint.reporter('default'));
}
));
});
/**
* compile templates into js
*/
gulp.task('js-templates', function () {
return gulp.src('src/templates/*.html')
.pipe(watch(function(files) {
return files
.pipe(templateCache({
module: 'AngularNotifyModule'
}))
.pipe(rename('angular-notify-template.js'))
.pipe(gulp.dest('src/js/'));
}
));
});
/**
* concat all library files along with our
* sources into a single file
*/
gulp.task('js-build-dev', function () {
var allFiles = [
'./src/js/angular-notify-module.js',
'./src/js/angular-notify-template.js',
'./src/js/angular-notify-service.js',
'./src/js/angular-notify-directive.js'
];
return gulp.src(allFiles)
.pipe(watch(function (files) {
return gulp.src(allFiles)
.pipe(concat('angular-notify.js'))
.pipe(gulp.dest('./dist'));
}
));
});
/**
* take concatenated js build file, minify
*/
gulp.task('js-build-production', function () {
return gulp.src('./dist/angular-notify.js')
.pipe(uglify({
mangle: false}
))
.pipe(rename('angular-notify.min.js'))
.pipe(gulp.dest('./dist'));
});
/**
* connect server w/ reload
*/
gulp.task('connect-web-server', function () {
connect.server({
port: 8000,
root: [
'demo',
'.'
],
livereload: true
});
});
/**
* default task for development
*/
gulp.task('default', ['js-hint','js-templates','js-build-dev','connect-web-server']);
/**
* production related tasks without watch
*/
gulp.task('production', ['js-hint','js-build-production']);