-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
90 lines (72 loc) · 2.4 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
'use strict';
var gulp = require('gulp');
var connect = require('gulp-connect');
var merge = require('merge-stream');
var paths = {
statics: [
'src/index.html',
'src/index.css',
'src/index.js',
'src/templates/**/*.html',
'src/img/**/*'
],
build: 'build/**/*'
};
// copy static files
gulp.task('statics', function () {
var statics = gulp.src(paths.statics, {base: 'src'})
.pipe(gulp.dest('build'));
var angular = gulp.src([
'bower_components/angular/angular.min.js',
'bower_components/angular-animate/angular-animate.min.js',
]).pipe(gulp.dest('build/vendor/angular'));
var angularBootstrap = gulp.src('bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js')
.pipe(gulp.dest('build/vendor/angular-bootstrap'));
var bootstrap = gulp.src(
'bower_components/bootstrap/dist/**/*',
{base: 'bower_components/bootstrap/dist'}
)
.pipe(gulp.dest('build/vendor/bootstrap'));
var jquery = gulp.src('bower_components/jquery/dist/jquery.min.js')
.pipe(gulp.dest('build/vendor/jquery'));
var opensans = gulp.src([
'bower_components/open-sans-fontface/open-sans.css',
'bower_components/open-sans-fontface/fonts/**/*',
], {base: 'bower_components/open-sans-fontface'})
.pipe(gulp.dest('build/vendor/opensans'));
var fontawesome = gulp.src([
'bower_components/font-awesome/fonts/*',
'bower_components/font-awesome/css/font-awesome.min.css',
], {base: 'bower_components/font-awesome'})
.pipe(gulp.dest('build/vendor/fontawesome'));
return merge(statics, angular, angularBootstrap, bootstrap, fontawesome,
jquery, opensans);
});
gulp.task('clean', function(cb) {
var del = require('del');
del(['build/*'], cb);
});
// watch for changes
gulp.task('watch', ['default:watch'], function () {
gulp.watch(paths.statics, ['statics']);
});
// serve with livereload
gulp.task('serve', ['serve:connect', 'watch', 'serve:watch']);
// serve built files
gulp.task('serve:connect', ['default:watch'], function () {
connect.server({
root: 'build',
livereload: true,
});
});
// live reload
gulp.task('serve:reload', function () {
gulp.src(paths.build)
.pipe(connect.reload());
});
// watch built files and initiate live reload
gulp.task('serve:watch', ['default:watch'], function () {
gulp.watch(paths.build, ['serve:reload']);
});
gulp.task('default', ['statics']);
gulp.task('default:watch', ['statics']);