Skip to content

Commit 89acc5c

Browse files
MattSturgeonphated
authored andcommitted
Docs: Improve ES2015 task exporting examples (#1999)
1 parent 0ac9e04 commit 89acc5c

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

README.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,12 @@ const paths = {
149149
};
150150

151151
/*
152-
* For small tasks you can use arrow functions and export
152+
* For small tasks you can export arrow functions
153153
*/
154-
const clean = () => del([ 'assets' ]);
155-
export { clean };
154+
export const clean = () => del([ 'assets' ]);
156155

157156
/*
158-
* You can still declare named functions and export them as tasks
157+
* You can also declare named functions and export them as tasks
159158
*/
160159
export function styles() {
161160
return gulp.src(paths.styles.src)
@@ -177,13 +176,21 @@ export function scripts() {
177176
.pipe(gulp.dest(paths.scripts.dest));
178177
}
179178

180-
export function watch() {
179+
/*
180+
* You could even use `export as` to rename exported tasks
181+
*/
182+
function watchFiles() {
181183
gulp.watch(paths.scripts.src, scripts);
182184
gulp.watch(paths.styles.src, styles);
183185
}
186+
export { watchFiles as watch };
184187

185-
const build = gulp.series(clean, gulp.parallel(styles, scripts));
186-
export { build };
188+
/*
189+
* You can still use `gulp.task`
190+
* for example to set task names that would otherwise be invalid
191+
*/
192+
const clean = gulp.series(clean, gulp.parallel(styles, scripts));
193+
gulp.task('clean', clean);
187194

188195
/*
189196
* Export a default task

0 commit comments

Comments
 (0)