[英]Gulp giving error on symlinks in gulp.src()
I have a symlink in my images folder that points to another folder containing external images provided by a third party library (managed by bower - gotta love javascript). 我的图像文件夹中有一个符号链接指向包含第三方库提供的外部图像的另一个文件夹(由bower管理 - 得到爱javascript)。 As part of my build process, I compress all images as follows:
作为构建过程的一部分,我按如下方式压缩所有图像:
gulp.task('images', function() {
return gulp.src('static/img/**/*')
.pipe(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))
.pipe(gulp.dest('dist/img'))
});
When gulp gets to the symbolic link folder in the img folder, it returns 当gulp到达img文件夹中的符号链接文件夹时,它会返回
events.js:72
throw er; // Unhandled 'error' event
^
Error: EISDIR, read
Using gulp-debug shows that it baulks on the symlink folder. 使用gulp-debug显示它在符号链接文件夹上包含。 I am on Mac OSX and the symlink was created using ln -s.
我在Mac OSX上,使用ln -s创建了符号链接。 Any ideas?
有任何想法吗?
gulp.src()
uses node-glob , which doesn't crawl symlinks: gulp.src()
使用node-glob ,它不会抓取符号链接:
**
If a "globstar" is alone in a path portion, then it matches zero or more directories and subdirectories searching for matches.**
如果“globstar”在路径部分中是唯一的,则它匹配零个或多个目录以及搜索匹配的子目录。 It does not crawl symlinked directories.它不会抓取符号链接的目录。
Note that symlinked directories are not crawled as part of a
**
, though their contents may match against subsequent portions of the pattern.请注意,符号链接目录不会作为
**
一部分进行爬网,尽管它们的内容可能与模式的后续部分匹配。 This prevents infinite loops and duplicates and the like.这可以防止无限循环和重复等。
I don't know if it's supposed to error or just skip them. 我不知道它是错误还是只是跳过它们。
You can use the option 'follow: true' to make Gulp follow symlinks. 你可以使用'follow:true'选项让Gulp遵循符号链接。 For example:
例如:
gulp.src('static/img/**/*', { follow: true })
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.