-
Notifications
You must be signed in to change notification settings - Fork 12
/
gulpfile.js
116 lines (97 loc) · 2.82 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
var gulp = require('gulp');
var concat = require('gulp-concat');
var del = require('del');
var flatten = require('gulp-flatten');
var minify = require('gulp-minify');
var minifyCss = require('gulp-minify-css');
var merge = require('merge-stream');
var rename = require('gulp-rename');
var runSequence = require('run-sequence');
gulp.task('default', function() {
console.log('Running distribution sequence');
return runSequence(
'clean'
, 'copy-css'
, 'copy-fonts'
, 'copy-js'
, 'minify-css'
, 'minify-js'
, 'merge-css'
, 'merge-js'
, 'delete-obsolete-stuff'
);
});
gulp.task('clean', function () {
return del.sync([
'frontend/public/**/*'
]);
});
gulp.task('copy-css', function() {
console.log('Copying css');
return gulp.src('frontend/public_src/css/*.min.css')
.pipe(gulp.dest('frontend/public/css/'))
;
});
gulp.task('copy-fonts', function() {
console.log('Copying fonts');
return gulp.src('frontend/public_src/fonts/*')
.pipe(gulp.dest('frontend/public/fonts/'))
;
});
gulp.task('copy-js', function() {
console.log('Copying js');
return gulp.src('frontend/public_src/js/*.min.js')
.pipe(gulp.dest('frontend/public/js/'))
;
});
gulp.task('merge-css', function() {
console.log('Merging css');
return gulp.src([
'frontend/public/css/bootstrap.min.css'
, 'frontend/public/css/tether.min.css'
, 'frontend/public/css/font-awesome.min.css'
, 'frontend/public/css/sleeptalk.min.css'
])
.pipe(concat('css.min.css'))
.pipe(gulp.dest('frontend/public'))
;
});
gulp.task('merge-js', function() {
console.log('Merging js');
return gulp.src([
'frontend/public/js/jquery-2.1.4.min.js'
, 'frontend/public/js/tether.min.js'
, 'frontend/public/js/bootstrap.min.js'
, 'frontend/public/js/wavesurfer.min.js'
, 'frontend/public/js/wavesurfer.regions-min.js'
, 'frontend/public/js/sleeptalk-min.js'
])
.pipe(concat('js.min.js'))
.pipe(gulp.dest('frontend/public'))
;
});
gulp.task('minify-css', function() {
console.log('Minifying css');
return gulp.src('frontend/public_src/css/sleeptalk.css')
.pipe(minifyCss({compatibility: 'ie8'}))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('frontend/public/css/'))
;
});
gulp.task('minify-js', function() {
console.log('Minifying js');
return gulp.src([
'frontend/public_src/js/sleeptalk.js'
, 'frontend/public_src/js/wavesurfer.regions.js'
])
.pipe(minify())
.pipe(gulp.dest('frontend/public/js/'))
;
});
gulp.task('delete-obsolete-stuff', function() {
console.log('Deleting obsolete stuff');
del.sync([
'frontend/public/css'
, 'frontend/public/js'
]);
});