下面的 gulp 重命名任务适用于带有一个点的 angularjs2 ts 文件,例如 appcomponent.ts。但是,如果文件名有两个点,例如 login.service.ts,gulp extname 就会混淆,并将第一个点之后的任何内容作为扩展名。知道如何让 extname 知道扩展名在最后一个点之后吗?
gulp.task('ts', function () {
return gulp.src('src/**/*.ts')
.pipe(rename({
extname: ''
}))
.pipe(traceur({
modules: 'instantiate',
moduleName: true,
annotations: true,
types: true,
memberVariables: true
}))
.pipe(rename({
extname: '.js'
}))
.pipe(gulp.dest('build'));
});