G
G
Galdar Turin2020-08-13 12:03:03
gulp.js
Galdar Turin, 2020-08-13 12:03:03

Why is the task called several times in a row?

const {
    src,
    dest,
    parallel,
    series,
    watch
}                   = require('gulp')

const zip           = require('gulp-zip')


/**
 * Начало сборки
 * @object startBuild
 */
const startBuild = {
    
    // Инициализация сборки виджета
    init: async function() {

        // Отслеживание файлов
        tracking()

        // Архивирование виджета
        archiving()

    }

}

/**
 * Отслеживание изменений
 * @function tracking
 */
function tracking() {

    watch(['app/**/*'], archiving)

}

/**
 * Архивирование виджета
 * @function archiving
 */
function archiving() {

    return src('app/*')
    .pipe(zip('widget.zip'))
    .pipe(dest('widget'))

}

exports.tracking = tracking()
exports.archiving = archiving()

// Запуск сборки
exports.default = parallel( startBuild.init )


[11:53:14] Using gulpfile /gulpfile.js
[11:53:14] Starting 'default'...
[11:53:14] Starting 'tracking'...
[11:53:17] Starting 'archiving'...
[11:53:17] Starting 'archiving'...
[11:53:17] Finished 'archiving' after 17 ms
[11:53:17] Finished 'archiving' after 15 ms

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2020-08-13
@Galdar

exports.tracking = tracking()
exports.archiving = archiving()

function call

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question