-
Notifications
You must be signed in to change notification settings - Fork 297
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1737 from google/enhancement/1356-gulp-upgrade
Upgrade gulp and rework gulp tasks.
- Loading branch information
Showing
14 changed files
with
2,518 additions
and
3,149 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ) ); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
); |
Oops, something went wrong.