forked from SOCR/BlueML
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
98 lines (86 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
var gulp = require('gulp');
var webserver = require('gulp-webserver');
var minifycss = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var sourcemaps = require('gulp-sourcemaps');
var minifyhtml = require('gulp-minify-html');
var responsive = require('gulp-responsive');
var imagemin = require('gulp-imagemin');
var gutil = require('gulp-util');
var connect = require('gulp-connect');
var exec = require('child_process').exec
var paths = {
scripts: ['public/js/*.js'],
styles: ['public/css/*.css'],
images: ['public/static/images/*']
};
gulp.task('nodestart', function () {
exec('node bin/www', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
});
});
gulp.task('styles', function() {
return gulp.src(paths.styles)
.pipe(minifycss({compatibility: 'chrome10'}))
.pipe(gulp.dest('build/css/'))
.pipe(connect.reload());
});
gulp.task('scripts', function() {
return gulp.src(paths.scripts)
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(sourcemaps.write())
.pipe(gulp.dest('build/js/'))
.pipe(connect.reload());
});
gulp.task('html', function() {
return gulp.src(paths.html)
.pipe(minifyhtml({
empty: true,
quotes: true
}))
.pipe(gulp.dest('build'));
});
gulp.task('images', function() {
return gulp.src(paths.images)
.pipe(responsive({
'BlockM-rball.png': {
width: 32,
height: 32
},
'blueML_logo.png': {
width: 216,
height: 86
}
}))
.pipe(gulp.dest('build/images/'));
});
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.styles, ['styles']);
gulp.watch(paths.images, ['images']);
});
gulp.task('clean', function() {
return del(['build/css/', 'build/js/', 'build/images/']);
});
gulp.task('webserver', function() {
gulp.src('build')
.pipe(webserver({
livereload: true,
directoryListing: true,
}));
});
gulp.task('connect', function() {
connect.server({
root: '.',
livereload: true
})
});
gulp.task('ETL', function() {
exec('node ETL.js', function (err, stdout, stderr) {
console.log(stdout);
});
});
gulp.task('default', ['nodestart', 'styles', 'scripts', 'images', 'watch', 'webserver', 'connect']);
gulp.task('startup',['ETL']);