Skip to content

Commit

Permalink
Docs: Improve ES2015 task exporting examples (#1999)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattSturgeon authored and phated committed Dec 31, 2017
1 parent 0ac9e04 commit 89acc5c
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions README.md
Expand Up @@ -149,13 +149,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 @@ -177,13 +176,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

0 comments on commit 89acc5c

Please sign in to comment.