Skip to content

Add generateParallel and generateSeries helpers for hooks. #220

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

Merged
merged 1 commit into from
Apr 27, 2023
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
32 changes: 23 additions & 9 deletions .core/gulp.tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,14 +241,28 @@ const reactium = (gulp, config, webpackConfig) => {
.pipe(rename(assetPath))
.pipe(gulp.dest(config.dest.assets));

const generateParallel = (arr = []) => {
return gulp.parallel(
...arr.map(t => {
if (typeof t === 'string') {
return task(t);
} else if (Array.isArray(t)) {
return generateSeries(t);
}
}),
);
};

const generateSeries = (arr = []) => {
return arr.map(t => {
if (typeof t === 'string') {
return task(t);
} else if (Array.isArray(t)) {
return gulp.parallel(...t.map(task));
}
});
return gulp.series(
...arr.map(t => {
if (typeof t === 'string') {
return task(t);
} else if (Array.isArray(t)) {
return generateParallel(t);
}
}),
);
};

const build = cfg => {
Expand All @@ -268,7 +282,7 @@ const reactium = (gulp, config, webpackConfig) => {

ReactiumGulp.Hook.runSync('build-series', series);

return gulp.series(...generateSeries(series));
return generateSeries(series);
};

const apidocs = done => {
Expand Down Expand Up @@ -843,7 +857,7 @@ $color: map.set($color, "{{key}}", \${{{ key }}});
return series;
};

const styles = gulp.series(...generateSeries(getStyleSeries()));
const styles = generateSeries(getStyleSeries());

const compress = done =>
isDev
Expand Down