-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathgulpfile.js
36 lines (33 loc) · 884 Bytes
/
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
const gulp = require( 'gulp' );
const zip = require( 'gulp-zip' );
const rename = require( 'gulp-rename' );
const path = require( 'path' );
function zipBundle() {
const bundleDirName = 'site-performance-tracker';
return gulp
.src(
[
'*.php',
'README.md',
'css/**/*.css',
'js/dist/**/*.js',
'js/dist/**/*.php',
'php/**/*.php',
],
{
base: __dirname, // Resolve file paths relative to the plugin root directory.
}
)
.pipe(
rename( ( filePath ) => {
filePath.dirname = path.join( bundleDirName, filePath.dirname ); // Move files into a "fake" directory.
console.log( // eslint-disable-line no-console
`Adding: ${ filePath.dirname }/${ filePath.basename }${ filePath.extname }`
);
return filePath;
} )
)
.pipe( zip( `${ bundleDirName }.zip` ) )
.pipe( gulp.dest( __dirname ) );
}
exports.zip = zipBundle;