Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve ES2015 task exporting examples for 4.0 #1999

Merged
merged 1 commit into from
Jul 24, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,12 @@ const paths = {
};

/*
* For small tasks you can use arrow functions and export
* For small tasks you can export arrow functions
*/
const clean = () => del([ 'assets' ]);
export { clean };
export const clean = () => del([ 'assets' ]);

/*
* You can still declare named functions and export them as tasks
* You can also declare named functions and export them as tasks
*/
export function styles() {
return gulp.src(paths.styles.src)
Expand All @@ -173,13 +172,21 @@ export function scripts() {
.pipe(gulp.dest(paths.scripts.dest));
}

export function watch() {
/*
* You could even use `export as` to rename exported tasks
*/
function watchFiles() {
gulp.watch(paths.scripts.src, scripts);
gulp.watch(paths.styles.src, styles);
}
export { watchFiles as watch };

const build = gulp.series(clean, gulp.parallel(styles, scripts));
export { build };
/*
* You can still use `gulp.task`
* for example to set task names that would otherwise be invalid
*/
const clean = gulp.series(clean, gulp.parallel(styles, scripts));
gulp.task('clean', clean);

/*
* Export a default task
Expand Down