B
B
bormor2017-12-12 11:35:18
Building projects
bormor, 2017-12-12 11:35:18

Gulp - how to copy files from build after build?

I'm trying to copy files after build to build.
I implement as standard

gulp.task('copy-from-build:css', () => {
    gulp.src('build/css/**/*.*').pipe(gulp.dest('folder/css/'));
});

When I run gulp copy-from-build:css everything works fine.
When I try to bind a task to gulp build, the build is built, but the files are not copied from it.
***
Sources:
gulp.task('build', function(cb) {
    runSequence(
        'clean',

        [
            'html-njk', //templating with nunjucks
            'css',
            'js-gulp',
        ],

        'copy:js-single-files',
        'copy:favicon',
        'copy:fonts',
        'copy:img',

        'copy-from-build:css',

        cb
    );
});

Console log:
[10:29:38] Starting 'build'...
[10:29:38] Starting 'clean'...
[10:29:38] Finished 'clean' after 22 ms
[10:29:38] Starting 'html-njk'...
[10:29:38] Finished 'html-njk' after 12 ms
[10:29:38] Starting 'css'...
[10:29:38] Finished 'css' after 6.74 ms
[10:29:38] Starting 'js-gulp'...
[10:29:38] Finished 'js-gulp' after 2.99 ms
[10:29:38] Starting 'copy:js-single-files'...
[10:29:38] Finished 'copy:js-single-files' after 1.32 ms
[10:29:38] Starting 'copy:favicon'...
[10:29:38] Finished 'copy:favicon' after 671 μs
[10:29:38] Starting 'copy:fonts'...
[10:29:38] Finished 'copy:fonts' after 547 μs
[10:29:38] Starting 'copy:img'...
[10:29:38] Finished 'copy:img' after 814 μs
[10:29:38] Starting 'copy-from-build:css'...
[10:29:38] Finished 'copy-from-build:css' after 526 μs
[10:29:38] Finished 'build' after 68 ms

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bormor, 2017-12-12
@bormor

Thanks Andrey Sanych .
The problem was a missing return in one of the tasks.
Those.
gulp.task('name', function(cb) {
return ...
});
It is he who signals about the end of the task and allows you to perform tasks synchronously.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question