Last active
October 31, 2019 11:43
-
-
Save tristolliday/c620de95d73b55e33b8491b0620e13af to your computer and use it in GitHub Desktop.
Migrate a gulp 3 task to gulp 4
This file contains hidden or 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
| // Gulp 3 Task | |
| var gulp = require("gulp"); | |
| var rename = require('gulp-rename'); | |
| var coreScripts = []; // your main scripts | |
| gulp.task('scripts', function () { | |
| return gulp.src(coreScripts) | |
| .pipe(concat('global.js')) | |
| .pipe(gulp.dest('blah/html/js')) | |
| .pipe(rename('global.min.js')) | |
| .pipe(gulp.dest('blah/html/js')) | |
| //.pipe(browserSync.reload({ | |
| // stream: true | |
| //})) | |
| }); | |
| // Gulp 4 Task | |
| const { src, dest, series, parallel } = require('gulp'); | |
| const rename = require('gulp-rename'); | |
| const coreScripts = []; // your main scripts | |
| const scriptsTask = function () { | |
| return src(coreScripts) | |
| .pipe(concat('global.js')) | |
| .pipe(dest('blah/html/js')) | |
| .pipe(rename({ extname: '.min.js' })) | |
| .pipe(dest('blah/html/js')); | |
| }; | |
| exports.build = series(buildScripts, xxx, ...); // for tasks that run in series | |
| // or | |
| exports.build = parallel(buildScripts, xxx, ...); // for tasks that run in parallel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment