我的图像文件夹中有一个符号链接指向包含第三方库提供的外部图像的另一个文件夹(由bower管理 – 得到爱
javascript).作为构建过程的一部分,我按如下方式压缩所有图像:
gulp.task('images',function() { return gulp.src('static/img/**/*') .pipe(imagemin({ optimizationLevel: 3,progressive: true,interlaced: true })) .pipe(gulp.dest('dist/img')) });
events.js:72 throw er; // Unhandled 'error' event ^ Error: EISDIR,read
使用gulp-debug显示它在符号链接文件夹上包含.我在Mac OSX上,使用ln -s创建了符号链接.有任何想法吗?
解决方法
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. 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.
我不知道它是错误还是只是跳过它们.