-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
96 lines (79 loc) · 1.85 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
'use strict';
const gulp = require('gulp');
const $ = require('gulp-load-plugins')();
//DEV
lrTask('css', './tasks/css', {
src: 'app/sass/main.sass',
dst: 'app/css',
});
lrTask('html', './tasks/html', {
src: 'app/jade/index.jade',
dst: 'app/',
});
lrTask('connect', './tasks/connect', {
servOpt: {
root: 'app',
livereload: true,
port: 8000,
}
});
/*
lrTask('svgSprite', './tasks/svgSprite', {
src: 'app/img/icons/*.svg',
dst: 'app/img/'
});*/
lrTask('js', './tasks/js', {
src: 'app/js/**/*.js',
dst: 'app/js/',
});
//BUILD
lrTask('build:useref', './tasks/build_useref', {
src: 'app/index.html',
dst: 'dist/',
});
lrTask('build:clean', './tasks/build_clean', {
src: 'dist',
});
lrTask('build:img', './tasks/build_img', {
src: ['app/**/*.{png,jpg,bmp,gif}'],
dst: 'dist/',
});
lrTask('build:svgmin', './tasks/svgSprite', {
src: 'dist/img/**/*.svg',
dst: 'app/img/'
})
lrTask('build:html', './tasks/build_html', {
src: 'dist/**/*.html',
dst: 'dist/',
});
lrTask('build:connect', './tasks/build_connect', {
servOpt: {
root: 'dist/',
livereload: false,
port: 8888,
}
});
gulp.task('build', gulp.series(
'build:clean',
gulp.parallel(gulp.series('build:useref', 'build:html'), 'build:img')
));
//WATCH
gulp.task('watch', () => {
gulp.watch('app/sass/**/*.sass', gulp.parallel('css'));
gulp.watch('app/jade/**/*.jade', gulp.parallel('html'));
gulp.watch('app/js/**/*.js', gulp.parallel('js'));
});
//DEFAULT
gulp.task('default', gulp.series(
gulp.parallel('css', 'html', 'js'),
gulp.parallel('connect', 'watch'),
));
//SYSTEM
function lrTask(taskName, path, options) {
options = options || {};
options.taskName = taskName;
gulp.task(taskName, function(callback) {
let task = require(path).call(this, options);
return task(callback);
});
}