我正在尝试使用gulp自动生成清单文件,但是找不到如何获取文件名,对其进行修改并通过管道将其发送出去。
var fs = require('fs');
var content = 'test';
gulp.src('./wwwroot/**/*.file')
.pipe(fs.writeFileSync(??? , content))
.pipe(gulp.dest('./wwwroot/')); // should be same as original file
凡???
在4号线是的,我想有filename.file.manifest
。上面的代码更多是一个主意,因为gulp.dest和fs都写入文件。
不使用管道,但是使用node glob还是一个不错的解决方案
var content = 'test'
glob("./wwwroot/**/*.file", null, function(er, files) {
if(er)
return;
files.forEach(function(element) {
var manifestFile = element + '.manifest';
fs.writeFileSync(manifestFile, content);
console.log("Generated: " + element);
});
})
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句