I have a directory setup like this:
I'm trying to copy these to a dist folder like this:
I've tried a number of variations, such as
gulp.src(['src/**/*', 'node_modules/**']).pipe(gulp.dest('dist'));
But this places all of the node_modules in the /dist and not within the node_modules directory.
Any idea how I can do this?
You need to tell gulp.src
that the base directory for node_modules/**
is .
so that the node_modules
created at the destination. However, you cannot set the base to .
for src/**/*
because that would mean that the src
directory would be created in your destination. So you need in effect to specify two sets of sources. gulp-add-src
can help with this.
Something like this should work:
var addsrc = require("gulp-add-src");
gulp.src('src/**/*')
.pipe(addsrc('node_modules/**', { base: '.'})
.pipe(gulp.dest('dist'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.