javascript – gulp在gulp.src()中的符号链接上给出错误

我的图像文件夹中有一个符号链接指向包含第三方库提供的外部图像的另一个文件夹(由bower管理 – 得到爱 javascript).作为构建过程的一部分,我按如下方式压缩所有图像:
gulp.task('images',function() {
return gulp.src('static/img/**/*')
    .pipe(imagemin({ optimizationLevel: 3,progressive: true,interlaced: true }))
    .pipe(gulp.dest('dist/img'))
});

当gulp到达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.

我不知道它是错误还是只是跳过它们.

相关文章

前言 做过web项目开发的人对layer弹层组件肯定不陌生,作为l...
前言 前端表单校验是过滤无效数据、假数据、有毒数据的第一步...
前言 图片上传是web项目常见的需求,我基于之前的博客的代码...
前言 导出Excel文件这个功能,通常都是在后端实现返回前端一...
前言 众所周知,js是单线程的,从上往下,从左往右依次执行,...
前言 项目开发中,我们可能会碰到这样的需求:select标签,禁...