Skip to content

Commit

Permalink
Merge pull request #1737 from google/enhancement/1356-gulp-upgrade
Browse files Browse the repository at this point in the history
Upgrade gulp and rework gulp tasks.
  • Loading branch information
felixarntz authored Jul 8, 2020
2 parents e428747 + 8cea293 commit fd01c7d
Show file tree
Hide file tree
Showing 14 changed files with 2,518 additions and 3,149 deletions.
21 changes: 0 additions & 21 deletions gulp-tasks/browsersync.js

This file was deleted.

28 changes: 0 additions & 28 deletions gulp-tasks/copy.js

This file was deleted.

22 changes: 0 additions & 22 deletions gulp-tasks/imagemin.js

This file was deleted.

26 changes: 0 additions & 26 deletions gulp-tasks/svgmin.js

This file was deleted.

28 changes: 0 additions & 28 deletions gulp-tasks/svgstore.js

This file was deleted.

28 changes: 0 additions & 28 deletions gulp-tasks/webpack.js

This file was deleted.

91 changes: 0 additions & 91 deletions gulpfile.babel.js

This file was deleted.

44 changes: 44 additions & 0 deletions gulpfile.js/copy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Gulp copy task.
*
* Site Kit by Google, Copyright 2020 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* External dependencies
*/
const gulp = require( 'gulp' );

module.exports = function() {
const globs = [
'readme.txt',
'google-site-kit.php',
'dist/*.js',
'dist/assets/**/*',
'bin/**/*',
'includes/**/*',
'third-party/**/*',
'!third-party/**/**/{tests,Tests,doc?(s),examples}/**/*',
'!third-party/**/**/{*.md,*.yml,phpunit.*}',
'!**/*.map',
'!bin/local-env/**/*',
'!bin/local-env/',
'!dist/admin.js',
'!dist/adminbar.js',
'!dist/wpdashboard.js',
];

return gulp.src( globs, { base: '.' } ).pipe( gulp.dest( 'release/google-site-kit' ) );
};
77 changes: 77 additions & 0 deletions gulpfile.js/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/**
* Gulp config.
*
* Site Kit by Google, Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

/**
* External dependencies
*/
const gulp = require( 'gulp' );
const imagemin = require( 'gulp-imagemin' );
const pump = require( 'pump' );
const del = require( 'del' );

/**
* Gulp tasks
*/
const copy = require( './copy' );
const svgmin = require( './svgmin' );
const svgstore = require( './svgstore' );
const zip = require( './zip' );

/**
* Gulp task to clean up release folder.
*
* @param {Function} cb The callback indicating the end of the task execution.
*/
function cleanRelease( cb ) {
del.sync( './release/**' );
cb();
}

/**
* Gulp task to minify images.
*
* @param {Function} cb The callback indicating the end of the task execution.
*/
exports.imagemin = function( cb ) {
pump(
[
gulp.src( './assets/images/*' ),
imagemin(),
gulp.dest( './dist/assets/images' ),
],
cb
);
};

/**
* Gulp task to minify and combine svg's.
*/
exports.svg = gulp.series(
svgstore,
svgmin,
);

/**
* Gulp task to run the default release processes in a sequential order.
*/
exports.release = gulp.series(
cleanRelease,
copy,
zip,
cleanRelease,
);
Loading

0 comments on commit fd01c7d

Please sign in to comment.