我想在我的角度app中缩小打字稿文件。我尝试通过在我的Gruntfile.js中给出grunt命令
uglify:{
ts:{
src:['test/scripts/**/*.ts'],
dest:'test/scripts/**/*.ts'
},
js:{
src:['test/scripts/hr.js'],
dest:'test/scripts/hr.js'
}
}
当我运行命令grunt uglify
js文件被uglified而不是ts文件。我怎样才能缩小ts文件?
答案 0 :(得分:2)
这是你应该编写gruntfile的方式:
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
typescript: {
base: {
src:['test/scripts/**/tsfile.ts'],
dest:'test/scripts/**/tsfile.js'
options: {
sourcemap: true,
declaration: false
}
}
},
uglify: {
dist: {
files: {
'test/scripts/**/tsfile.min.js': ['test/scripts/**/tsfile.js'],
'test/scripts/hr.js' : ['test/scripts/hr.js']
}
}
}
});