-
Notifications
You must be signed in to change notification settings - Fork 6
/
gulpfile.js
91 lines (82 loc) · 1.7 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
var gulp = require("gulp"),
sass = require("gulp-sass"),
rename = require("gulp-rename"),
prefix = require("gulp-autoprefixer"),
plumber = require("gulp-plumber"),
notify = require("gulp-notify"),
wpPot = require('gulp-wp-pot'),
clean = require("gulp-clean"),
zip = require("gulp-zip"),
fs = require('fs'),
path = require('path');
var onError = function (err) {
notify.onError({
title: "Gulp",
subtitle: "Failure!",
message: "Error: <%= error.message %>",
sound: "Basso",
})(err);
this.emit("end");
};
gulp.task('makepot', function () {
return gulp
.src('**/*.php')
.pipe(plumber({
errorHandler: onError
}))
.pipe(wpPot({
domain: 'oxygen-tutor-lms',
package: 'Tutor LMS'
}))
.pipe(gulp.dest('languages/oxygen-tutor-lms.pot'));
});
/**
* Build
*/
gulp.task("clean-zip", function () {
return gulp.src("./oxygen-tutor-lms.zip", {
read: false,
allowEmpty: true
}).pipe(clean());
});
gulp.task("clean-build", function () {
return gulp.src("./build", {
read: false,
allowEmpty: true
}).pipe(clean());
});
gulp.task("copy", function () {
return gulp
.src([
"./**/*.*",
"!./build/**",
"!./assets/**/*.map",
"!./assets/scss/**",
"!./assets/.sass-cache",
"!./node_modules/**",
"!./**/*.zip",
"!.github",
"!./gulpfile.js",
"!./readme.md",
"!./README.md",
"!.DS_Store",
"!./**/.DS_Store",
"!./LICENSE.txt",
"!./package.json",
"!./package-lock.json",
])
.pipe(gulp.dest("build/"));
});
gulp.task("make-zip", function () {
return gulp.src("./build/**/*.*").pipe(zip(`oxygen-tutor-lms.zip`)).pipe(gulp.dest("./"));
});
/**
* Export tasks
*/
exports.build = gulp.series(
"clean-zip",
"clean-build",
"makepot",
"copy",
"make-zip"
);