A
A
Andrej Sharapov2019-06-04 10:58:26
gulp.js
Andrej Sharapov, 2019-06-04 10:58:26

Is it possible to set a single path for gulp concat?

Actually, the question is in the title.
I have a folder with a large attachment, like this:

gulp.task('js', function(){
    return gulp.src(['/application/assets/js/jquery-1.11.21.min.js',
                     '/application/assets/js/ripples.min.js',
                     '/application/assets/js/lib/toastr/toastr.min.js',
                     '/application/assets/js/bootstrap.min.js',
                     '/application/assets/js/textChange.js',
                     '/application/assets/js/material.js',
                     '/application/assets/js/lib/fancybox/jquery.fancybox.pack.js',
                     '/application/assets/js/lib/boxLoader/js/jquery.boxloader.min.js'])
        .pipe(concat('script.js'))
        .pipe(gulp.dest('application/assets/build/js/'));
});

Is it possible to prescribe a common path /application/assets/js/and then just display the necessary names?
Presumably, the task should look like this:
return gulp.src( '/application/assets/js/' + ['jquery-1.11.21.min.js', 'ripples.min.js', ...] )

Is it really possible to do this? Or do I need to prescribe the entire repeated path for each file?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Danila, 2019-06-04
@Madeas

return gulp.src(['jquery-1.11.21.min.js', 'ripples.min.js', ...].map(
        file => `/application/assets/js/${file}`
    )
)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question