-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
73 lines (62 loc) · 1.9 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
var gulp = require('gulp');
var less = require('gulp-less');
var cssmin = require('gulp-cssmin');
var rename = require('gulp-rename');
var eslint = require('gulp-eslint');
var eslintIfFixed = require('gulp-eslint-if-fixed');
gulp.task('defaukt', function () {
gulp.run('watch');
});
gulp.task('less', function () {
return gulp.src('./src/less/styles.less')
.pipe(less())
.pipe(cssmin())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest('./public/css'));
});
gulp.task('eslint', function () {
return gulp.src(['./src/js/**/*.js','!src/js/lib/**','!node_modules/**'])
.pipe(eslint({fix:true}))
.pipe(eslint.format())
.pipe(eslintIfFixed('./public/js'))
.pipe(eslint.failAfterError());
});
gulp.task('copy-img', function () {
return gulp.src(['./src/img/**/*'])
.pipe(gulp.dest('./public/img'));
});
gulp.task('copy-audio', function () {
return gulp.src(['./src/audio/**/*'])
.pipe(gulp.dest('./public/audio'));
});
gulp.task('copy-video', function () {
return gulp.src(['./src/video/**/*'])
.pipe(gulp.dest('./public/video'));
});
gulp.task('copy-config', function () {
return gulp.src(['./src/config/**/*'])
.pipe(gulp.dest('./public/config'));
});
gulp.task('copy-fonts', function () {
return gulp.src(['./src/fonts/**/*'])
.pipe(gulp.dest('./public/fonts'));
});
gulp.task('copy', function() {
gulp.run('copy-img');
gulp.run('copy-audio');
gulp.run('copy-video');
gulp.run('copy-config');
gulp.run('copy-fonts');
});
gulp.task('publish', function() {
gulp.run('eslint');
gulp.run('less');
gulp.run('copy');
});
gulp.task('watch', function() {
gulp.watch('./src/js/**/*.js', ['eslint']);
gulp.watch('./src/less/**/*.less', ['less']);
gulp.watch(['./src/img/**','./src/audio/**','./src/video/**','./src/config/**'], ['copy']);
});