-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
73 lines (63 loc) · 2.04 KB
/
gulpfile.js
File metadata and controls
73 lines (63 loc) · 2.04 KB
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
var gulp = require('gulp');
var plugins = require("gulp-load-plugins")({lazy:false});
gulp.task('scripts', function(){
//combine all js files of the app
gulp.src(['!./app/**/*_test.js','./app/**/*.js'])
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('default'))
.pipe(plugins.concat('app.js'))
.pipe(gulp.dest('./build'));
});
gulp.task('templates',function(){
//combine all template files of the app into a js file
gulp.src(['!./app/index.html', './app/**/*.html'])
.pipe(plugins.angularTemplatecache('templates.js',{standalone:true}))
.pipe(gulp.dest('./build'));
});
gulp.task('css', function(){
gulp.src('./app/**/*.css')
.pipe(plugins.concat('app.css'))
.pipe(gulp.dest('./build'));
});
gulp.task('vendorJS', function(){
var V = function(p){return './bower_components/' + p;};
//concatenate vendor JS files
gulp.src([
V('angular/angular.js'),
V('angular-mocks/angular-mocks.js'),
V('angular-ui-router/release/angular-ui-router.js'),
])
.pipe(plugins.concat('lib.js'))
.pipe(gulp.dest('./build'));
});
gulp.task('vendorCSS', function(){
//concatenate vendor CSS files
gulp.src(['!./bower_components/**/*.min.css',
'./bower_components/**/*.css'])
.pipe(plugins.concat('lib.css'))
.pipe(gulp.dest('./build'));
});
gulp.task('copy-index', function() {
gulp.src('./app/index.html')
.pipe(gulp.dest('./build'));
});
gulp.task('watch',function(){
gulp.watch([
'build/**/*.html',
'build/**/*.js',
'build/**/*.css'
], function(event) {
return gulp.src(event.path)
.pipe(plugins.connect.reload());
});
gulp.watch(['./app/**/*.js','!./app/**/*test.js'],['scripts']);
gulp.watch(['!./app/index.html','./app/**/*.html'],['templates']);
gulp.watch('./app/**/*.css',['css']);
gulp.watch('./app/index.html',['copy-index']);
});
gulp.task('connect', plugins.connect.server({
root: ['build'],
port: 9000,
livereload: true
}));
gulp.task('default',['connect','scripts','templates','css','copy-index','vendorJS','vendorCSS','watch']);