我有一个简单的gulp任务,它将文件夹树从node-modules
移动到一个特定的目标,保持文件夹结构如下:
function libraries(){
let libPaths = [
'./node_modules/jquery/dist/**/*.*', // Note: copying the ``dist`` folder
'./node_modules/bootstrap-icons/**/*.*' // Note: copying the module
]
return gulp.src(libPaths, {base: './node_modules/'})
.pipe(gulp.dest(
(vinyl) => {
// Something here?
return '/destination/'
}
)
);
}
结果:
destination
├── bootstrap-icons
│ ├── LICENSE.md
│ ├── README.md
│ ├── bootstrap-icons.svg
│ ├── font
│ ├── icons
│ └── package.json
└── jquery
└── dist // <- problem
├── jquery.js
├── jquery.min.js
├── jquery.min.map
├── jquery.slim.js
├── jquery.slim.min.js
└── jquery.slim.min.map
预期:
destination
├── bootstrap-icons
│ ├── LICENSE.md
│ ├── README.md
│ ├── bootstrap-icons.svg
│ ├── font
│ ├── icons
│ └── package.json
└── jquery
├── jquery.js
├── jquery.min.js
├── jquery.min.map
├── jquery.slim.js
├── jquery.slim.min.js
└── jquery.slim.min.map
当源文件位于dist/
(例如./node_modules/jquery/dist/jquery.js
)内时,我如何检测以将目标输出设置为/destination/jquery/jquery.js
-而不是/destination/jquery/dist/jquery.js
。
1条答案
按热度按时间rks48beu1#
我是这样做的: