How to import gulp tasks?

user3591425

I'm referencing this article: https://css-tricks.com/combine-webpack-gulp-4/

And this repository: https://github.com/PascalAOMS/gulp4-webpack

I'm trying to import gulp tasks from one file into another. I tried by writing the tasks as functions then exporting those as normal, but started getting an error "Did you forget to signal async completion?". I also thought maybe I could write the tasks as usual, but wrap them in a function and export that, but the same error.

For more clarity I'm trying to figure out how to add tasks to the build gulp.series in this file https://github.com/PascalAOMS/gulp4-webpack/blob/master/tasks/index.js

Anyone have any ideas?

Here's the index.js

 import gulp from 'gulp';
 import { scripts } from './webpack';
 import { server }  from './server';
 import { assets } from './tasks/assets';

 export const dev   = gulp.series( server )
 export const build = gulp.series( scripts, assets )
 export default dev

Here's an example of the asset task:

import gulp from 'gulp';
const assets = () =>  {
   return gulp.src(fonts.src)
      .pipe(gulp.dest(fonts.dist));
}
export { assets };
user3591425

For whatever reason, this code suddenly works. Leaving it here in case it might help someone else:

index.js

import gulp from 'gulp';
import { scripts } from './webpack';
import { server }  from './server';
import { assets } from './tasks/assets';

export const dev   = gulp.series( server )
export const build = gulp.series( scripts, assets )
export default dev

task/assets.js

import gulp from 'gulp';
const assets = () =>  {
   return gulp.src(fonts.src)
      .pipe(gulp.dest(fonts.dist));
}
export { assets };

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related