
提供一个自动cache的transform,其API同readable-stream
How to use
1、编写的Gulp插件管道继承本包export的transform即可
2、生产环境中设置process.env.build_cache = "open"
打开cache
3、插件需要使用callback来返回流,否则该插件不生效cache
4、如果该流返回的文件有其他依赖,请在返回的file文件上附带depFiles: string[]来标明依赖文件的绝对路径
class Pipe extends Transform {};
const pipe = new Pipe({
objectMode: true,
transform: (file: File, enc, callback) => {
file.depFiles = ['/home/work/xxxxx/xxxx/a.js', '/home/work/xxxxx/xxxx/b.js'];
callback(null, file);
}
});
API
API DOC
Type aliases
Callback
Callback: function
Type declaration
-
- (buffer: any, file: File): void
transform
transform: function
Type declaration
-
- (file: File, enc: any, callback: any): void