'… paths.js'是什么意思在'gulp.src(,{base:'。'})'?
我有以下吞咽任务:
// Compile ES6 to ES5 and copy to dist gulp.task('babel', () => gulp.src([...paths.js, '!gulpfile.babel.js'], { base: '.' }) .pipe(plugins.newer('dist')) .pipe(plugins.sourcemaps.init()) .pipe(plugins.babel()) .pipe(plugins.sourcemaps.write('.', { includeContent: false, sourceRoot(file) { return path.relative(file.path, __dirname); } })) .pipe(gulp.dest('dist')) );
根据Gulp Doc( gulp.src ),我了解到gulp.src会发出匹配提供的glob或者globs数组的文件。
但是我无法理解这里'… paths.js'的含义。 项目目录中没有以“paths.js”命名的文件。
有没有人能帮我理解呢?
...
在这方面是ES2015(又名“ES6”) 扩展语法 :它将可迭代的内容(如数组)分散到数组中的离散元素中。
例:
let a = [1, 2, 3]; let b = [...a, 4, 5]; console.log(b); // 1, 2, 3, 4, 5