Advice wanted to optimize my gulp file

Hi there,

I’m new to Gulp and full of pride I’ve created my first series of tasks :grin:
However I would like to optimize my file a little bit and searching for advice.

This is my gulpfile.js

const { cssCompile, cssMinify, cssConcat, cssCleanTemp } = require("./gulp_tasks/css-compile.js");`
const { watch } = require("./gulp_tasks/watch.js");

const gulp = require('gulp');

module.exports = {
    'css-create': gulp.series(cssCleanTemp, cssCompile, cssConcat, cssMinify),
    'watch': gulp.series(watch)

and this is my watch.js

const { cssCompile, cssMinify, cssConcat, cssCleanTemp } = require('./css-compile.js');

const watch = function (done) {, gulp.series(cssCleanTemp, cssCompile, cssConcat, cssMinify));

module.exports = {

As you can see I’m repeating the whole series in my main gulpflile.js and in my watch.js.

How can I optimize this? Ideally I would like to do something like this in my gulpfile.js

'watch': gulp.series('css-create')

But this obviously doesn’t work.

Thanks in advance.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.