-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
92 lines (79 loc) · 2.8 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
const { gulp, src, dest, watch, series } = require('gulp');
const exec = require('child_process').exec;
// const uglify = require('gulp-uglify');
// const rename = require('gulp-rename');
// const babel = require('gulp-babel');
// const concat = require('gulp-concat');
// const minify = require('gulp-minify');
// const cleanCss = require('gulp-clean-css');
// const del = require('del');
// function deployjs() {
// return src('admin/master/**/*.js')
// //.pipe(babel())
// //.pipe(uglify())
// //.pipe(minify())
// .pipe(concat('script.js'))
// .pipe(dest('dist/gulp/'));
// }
// function babeljs() {
// return src('dist/gulp/script.js')
// .pipe(babel({ 'presets': ['@babel/preset-env'] }))
// .pipe(rename({ extname: '.min.js' }))
// .pipe(dest('dist/gulp/'));
// }
// function vendorjs() {
// return src('admin/assets/masters/**/*.js')
// //.pipe(babel())
// //.pipe(uglify())
// //.pipe(minify())
// .pipe(concat('vendor.min.js'))
// .pipe(dest('dist/gulp/'));
// }
// function vendorcss() {
// return src('admin/assets/masters/**/*.css')
// .pipe(cleanCss())
// .pipe(minify())
// .pipe(concat('vendor.min.css'))
// .pipe(dest('dist/gulp/'));
// }
// function deploycss() {
// return src('admin/master/**/*.css')
// .pipe(cleanCss())
// .pipe(minify())
// .pipe(concat('style.min.css'))
// .pipe(dest('dist/gulp/'));
// }
// async function delDist() {
// const deletedPaths = await del(['dist/gulp/']);
// console.log('Deleted files and directories:\n', deletedPaths.join('\n'));
// }
async function execC() {
exec('php admin/admin.php generateExtensions', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
console.log(err);
});
await Promise.resolve('good');
}
async function execBabel() {
exec('npx babel dist/script.js --out-file dist/script.min.js', function (err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
console.log(err);
});
await Promise.resolve('good');
}
function startWatchers() {
//watch('admin/master/**/*.css', deploycss);
//watch('admin/master/**/*.js', series(deployjs, babeljs));
watch('*.php', series(execC, execBabel));
watch('admin/*.php', series(execC, execBabel));
watch('admin/master/**/*.css', series(execC, execBabel));
watch('admin/master/**/*.js', series(execC, execBabel));
}
exports.watcher = startWatchers;
exports.builddev = series(execC, execBabel);
exports.buildprod = series(execC, execBabel);
//exports.vendor = series(vendorjs, vendorcss);
exports.default = series(execC, execBabel)
//exports.default = series(delDist, deployjs, deploycss, vendorjs, vendorcss, babeljs)