-
Notifications
You must be signed in to change notification settings - Fork 10
/
gulpfile.js
81 lines (68 loc) · 1.96 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
var execSync = require('child_process').execSync;
var path = require('path');
var gulp = require('gulp');
var jade = require('gulp-pug');
var less = require('gulp-less');
var babel = require('gulp-babel');
var plumber = require('gulp-plumber');
var autoprefixer = require('gulp-autoprefixer');
var del = require('del');
var markdown = require('jstransformer-markdown');
gulp.task('less', function () {
return gulp.src('src/less/style.less')
.pipe(less({
paths: [
path.join(__dirname, 'vendor'),
]
}))
.pipe(autoprefixer({
cascade: false,
}))
.pipe(gulp.dest('public/css'));
});
gulp.task('javascript', function() {
return gulp.src('src/javascript/**/*.js')
.pipe(babel())
.pipe(gulp.dest('public/js'));
});
gulp.task('templates', gulp.series(gulp.parallel('javascript', 'less'), function() {
return gulp.src(['src/templates/**/*.jade', '!src/templates/layout.jade'])
.pipe(jade({
locals: {}
}))
.pipe(gulp.dest('public/'));
}));
gulp.task('static', function() {
return gulp.src('src/static/**/*')
.pipe(gulp.dest('public'));
});
gulp.task('web', gulp.parallel('javascript', 'less', 'templates', 'static'));
gulp.task('xml', function(cb) {
switch (process.platform) {
case 'win32':
execSync('.\\src\\findxml.bat');
execSync('.\\src\\xml2json.py');
execSync('.\\src\\json2public.py');
break;
default:
execSync('./src/findxml');
execSync('./src/xml2json.py');
execSync('./src/json2public.py');
break;
}
cb();
});
gulp.task('clean', function() {
return del([
'public/**',
'xml/source/**',
'xml/json/**',
]);
});
gulp.task('build', gulp.parallel('xml', 'web'));
gulp.task('watch', gulp.series('web', function () {
gulp.watch('src/templates/**/*', gulp.series('web'));
gulp.watch('src/less/**/*', gulp.series('web'));
gulp.watch('src/javascript/**/*', gulp.series('web'));
gulp.watch('src/static/**/*', gulp.series('web'));
}));