forked from urielcaire/jbility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (62 loc) · 1.59 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');
var cleanCSS = require('gulp-clean-css');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var pump = require('pump');
var del = require('del');
var paths = {
in: {
js: 'src/js/*.js',
css: 'src/css/*.css',
img: 'src/img/**/*',
example: 'src/example/**/*'
},
out: {
js: 'dist/jbility/js',
css: 'dist/jbility/css',
img: 'dist/jbility/img',
example: 'dist/example'
}
};
gulp.task('clean', () => {
return del(['dist']);
});
gulp.task('minify-js', cb => {
pump([
gulp.src(paths.in.js),
gulp.dest(paths.out.js),
uglify(),
rename({suffix: '.min'}),
gulp.dest(paths.out.js)
], cb);
});
gulp.task('minify-css', cb => {
pump([
gulp.src(paths.in.css),
gulp.dest(paths.out.css),
cleanCSS({compatibility: 'ie8'}),
rename({suffix: '.min'}),
gulp.dest(paths.out.css)
], cb);
});
gulp.task('copy-images', cb => {
pump([
gulp.src(paths.in.img),
gulp.dest(paths.out.img)
], cb);
});
gulp.task('copy-example', cb => {
pump([
gulp.src(paths.in.example),
gulp.dest(paths.out.example)
], cb);
})
gulp.task('watch', () => {
gulp.watch(paths.in.js, ['minify-js']);
gulp.watch(paths.in.css, ['minify-css']);
gulp.watch(paths.in.image, ['copy-images']);
gulp.watch(paths.in.example, ['copy-example']);
})
gulp.task('all', ['minify-js', 'minify-css', 'copy-images', 'copy-example']);
gulp.task('build', ['all']);
gulp.task('default', ['watch', 'all']);