-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathgulpfile.js
70 lines (59 loc) · 1.65 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
var gulp = require('gulp'),
unglify = require('gulp-uglify'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
annotate = require('gulp-ng-annotate'),
del = require('del'),
ghPages = require('gulp-gh-pages'),
webserver = require('gulp-webserver');
var src = {
scripts: [
'./src/module.js',
'./src/metro.js',
'./src/metro-station.js',
'./src/metro-info.js',
'./src/metro-group.js'
],
svg: [
'./src/metro-moscow.svg',
'./src/metro-spb.svg'
]
};
gulp.task('clean', function () {
del(['./dist/*', './demo/*.js', './demo/*.svg'])
});
gulp.task('build', ['clean'], function () {
gulp.src(src.scripts)
.pipe(concat('dvhb_metro.js'))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./demo'))
.pipe(annotate())
.pipe(unglify())
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest('./dist'))
.pipe(gulp.dest('./demo'));
gulp.src(src.svg)
.pipe(gulp.dest('./demo'));
gulp.src(src.svg)
.pipe(gulp.dest('./dist'));
});
gulp.task('watch', function () {
gulp.watch([src.scripts, src.svg], ['build']);
});
gulp.task('ghPages', function () {
return gulp.src('./demo/**/*')
.pipe(ghPages({
remoteUrl: '[email protected]:dvhb/dvhb-metro.git'
}));
});
gulp.task('webserver', function () {
gulp.src('./demo')
.pipe(webserver({
host: '0.0.0.0',
// livereload: true,
open: false,
port: 8000,
fallback: './demo/index.html'
}))
});
gulp.task('default', ['build', 'webserver', 'watch']);