-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.babel.js
108 lines (102 loc) · 2.55 KB
/
gulpfile.babel.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
97
98
99
100
101
102
103
104
105
106
107
108
import { src, dest } from 'gulp';
import cleanCss from 'gulp-clean-css';
import postcss from 'gulp-postcss';
import rename from 'gulp-rename';
import concat from 'gulp-concat';
import autoprefixer from 'autoprefixer';
import webpack from 'webpack-stream';
import wpPot from "gulp-wp-pot";
import zip from "gulp-zip";
import info from "./package.json";
export const stylesfront = () => {
return src('assets/css/front/author-review.css')
.pipe(postcss([ autoprefixer ]))
.pipe(cleanCss({compatibility:'ie8'}))
.pipe(rename( { 'suffix': '.min' } ) )
.pipe(dest('assets/css/front'));
}
export const stylesadmin = () => {
return src('assets/css/admin/review.css')
.pipe(postcss([ autoprefixer ]))
.pipe(cleanCss({compatibility:'ie8'}))
.pipe(rename( { 'suffix': '.min' } ) )
.pipe(dest('assets/css/admin'));
}
export const scriptsfront = () => {
return src(['assets/js/front/jquery.ui.touch-punch.js','assets/js/front/jquery.appear.js', 'assets/js/front/custom-script.js'])
.pipe(concat('author-review.js'))
.pipe(dest('assets/js/front/'))
.pipe(webpack({
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
mode: 'production',
devtool: false,
output: {
filename: 'author-review.min.js'
},
}))
.pipe(dest('assets/js/front'));
}
export const scriptsadmin = () => {
return src(['assets/js/admin/jquery.jstepper.js', 'assets/js/admin/custom-script.js'])
.pipe(concat('author-review-admin.js'))
.pipe(dest('assets/js/admin/'))
.pipe(webpack({
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
mode: 'production',
devtool: false,
output: {
filename: 'author-review-admin.min.js'
},
}))
.pipe(dest('assets/js/admin'));
}
export const pot = () => {
return src("**/*.php")
.pipe(
wpPot({
domain: "pro-author-review",
package: info.name
})
)
.pipe(dest(`languages/${info.name}.pot`));
};
export const compress = () => {
return src([
"**/*",
"!node_modules{,/**}",
"!bundled{,/**}",
"!src{,/**}",
"!.babelrc",
"!.gitignore",
"!gulpfile.babel.js",
"!package.json",
"!package-lock.json",
"!README.md",
])
.pipe(zip(`${info.name}.zip`))
.pipe(dest('../'));
};