-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
78 lines (68 loc) · 1.77 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
'use strict';
var gulp = require('gulp'),
concat = require('gulp-concat'),
livereload = require('gulp-livereload'),
babel = require('gulp-babel'),
server = require('gulp-server-livereload'),
paths = {
dev: {
thirdParty: './src/third-party/**/*.js',
css: './src/css/**/*.css',
app: './src/app/**/*.js',
js: './src/js/**/*.js',
tests: './src/app/**/*.spec.js',
html: './src/app/**/*.html',
index: './src/index.html',
newBaseJS: []
},
build: {
root: './build/',
thirdPartyRoot: './build/third-party'
},
dist: {
app: 'app.js',
js: 'dist.js',
css: 'dist.css',
tests: 'tests.js',
thirdParty: 'third-party.js',
newBaseJS: 'new-base.js',
index: 'index.html'
}
};
gulp.task('build-app', function () {
return gulp.src([
paths.dev.js
]).pipe(babel({
modules: 'amd',
stage: 0
}))
//.pipe(concat(paths.dist.js))
.pipe(uglify())
.pipe(gulp.dest(paths.build.root))
.pipe(livereload());
});
gulp.task('build-index', function () {
return gulp.src([paths.dev.index])
.pipe(gulp.dest(paths.build.root))
.pipe(livereload());
});
gulp.task('webserver', function() {
gulp.src('./build')
.pipe(server({
//livereload: true,
open: true
}));
});
gulp.task('watch', function () {
gulp.watch([
paths.dev.js
], ['build-app']);
gulp.watch([
paths.dev.index
], ['build-index']);
});
gulp.task('default', ['watch', 'webserver']);
gulp.task('build', [
'build-app',
'build-index'
]);