Reputation: 227
I have a project with a certain folder structure and an other project which should be basically the same only some files are different.
I would like to write a gulp-task
(or tasks) which are copying the first projects folder structure, but only create symlinks
for the files, and don't overwrite files already in the other project.
I found out that I can create symlinks
with gulp
and vinyl-fs
.
I tried to create a two step task. First, I tried to copy the folder structure, but I don't know how can I tell gulp that I only care about the folder structure.
Then second, I wanted to create a symlink
task that is creating the symlinks
in the correct directory.
Maybe, I could create it with only vinyl-fs
's symlinks using a function parameter, but I can't find out how.
Upvotes: 1
Views: 1689
Reputation: 8423
It would seem you can do this to copy only folders (exclude *.*
):
gulp
.src(['base/path/**/*', '!base/path/**/*.*'])
.pipe(gulp.dest('target'));
Assuming all your files have some kind of extension (e.g. *.jpg
).
For the symlinks
, doesn't the following work?:
var vfs = require('vinyl-fs');
...
vfs
.src('base/path/**/*', { followSymlinks: false, nodir: true })
.pipe(vfs.symlink('target'));
...
Upvotes: 3