gulp.src does not copy subdirs within symlink
See original GitHub issue$ gulp -v
CLI version 1.2.2
Local version 4.0.0-alpha.2
Directory structure of images and symlink’ed directory (shared-assets
):
├── images
│ └── branding -> ../shared-assets/branding/ (this is a symlink)
├── shared-assets
│ ├── branding
│ │ ├── img1.png
│ │ ├── img2.png
│ │ └── dir1
│ │ ├── img3.png
│ │ └── img4.png
gulp.src('..../images/**/*.{.jpg,.png}').pipe(gulp.dest('dist/images'))
Produces:
├── images
│ ├── branding
│ │ ├── img1.png
│ │ └── img2.png
gulp.src('..../images/**/*').pipe(gulp.dest('dist/images')) // matches all files
Produces:
├── images
│ ├── branding
│ │ ├── img1.png
│ │ └── img2.png
│ └── dir1 (empty dir)
I expected dir1 and its contents to be in the output. To further clarify, I do want gulp to copy the contents (vs copying the symlink) which it does correctly with img1.png
, img2.png
, just not with subdirs or their contents img3.png
, img4.png
.
Is this expected behavior? Bug?
I don’t feel like it’s a fault of my glob string, since I can use /**/*.{jpg,png}
for any number of subdirs of any depth that aren’t symlinked.
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Gulp giving error on symlinks in gulp.src() - Stack Overflow
src () uses node-glob, which doesn't crawl symlinks: ** If a "globstar" is alone in a path portion, then it matches zero or...
Read more >gulp-rsync - npm
Enables files or directories matching the pattern(s) provided to be excluded from the transfer. This is probably most useful when recursive is ......
Read more >rollup.js
During this step, Rollup will build the module graph and perform tree-shaking, but will not generate any output. On a bundle object, you...
Read more >Sass to CSS > Gulp! Refreshment for Your Frontend Assets
I do have a project-specific CSS file, but it's missing from here. The problem is that it's not a CSS file at all...
Read more >Nixpkgs 22.11 manual - NixOS
Nix expressions describe how to build packages from source and are collected in the nixpkgs repository. Also included in the collection are Nix...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
followSymlinks
turns symbolic links into hard files (reads the contents of the linked file and creates duplicate files in the output, etc). It might be a poor name for what it actually does, but that’s what we have right now.follow
does something different, in which it follows symlinks throughout a tree, and isn’t enabled by default in node-glob because it breaks on circular links. Those 2 behaviors are mutually exclusive so we can’t forcefollow
on iffollowSymlinks
is set to true.It’s a frustrating state of naming but imagine
followSymlinks
asconvertToFile
and you’d have{ follow: true, convertToFile: true }
(notice how they are very different with better naming).I’m going to close this and chalk it up to a documentation problem (which have multiple issues open), but I’ll open an issue on vinyl-fs to revisit the naming of the
followSymlinks
option. Thanks for bringing this up!There is an option follow, which can help you.
gulp.src('..../images/**/*', { follow: true })
But be aware of cyclic links. That kind of mistake maybe cause delete of all files.
Optionally, you can use workaround too