重命名打字稿文件 [英] Rename a Typescript file

查看:36
本文介绍了重命名打字稿文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能是我在这个上遗漏了一些东西(或者可能是我太累了:P).在 Visual Studio 2012 中的 Typescript 项目中,当我重命名 ts 文件时,不是重命名与该 ts 文件链接的 js 文件,而是创建一个新文件.

May be I'm missing something on this one (or may be I'm too tired :P ). In Visual Studio 2012 in a Typescript project, when I rename a ts file, instead of rename the js file linked with that ts file, it creates a new one.

例如:
旧情况:(file1.ts --> file1.js)重命名后:(file1337.ts --> file.js) + file1337.js//file1337 不包含在项目中,我需要手动完成...

Ex :
Old situation : (file1.ts --> file1.js) After renaming : (file1337.ts --> file.js) + file1337.js //file1337 isn't include in project, I need to do it manually ...

那么有没有办法同时重命名 ts 文件和与该文件直接链接的 js,而无需创建新文件,而不必在项目中手动添加新的 js 文件?

So is there a way to rename both the ts file and the js directly linked with this file at the same time without creating a new one and having to manually adding the new js file in the project?

谢谢

推荐答案

我发现如果删除关联的 .js 文件和任何源映射(即在解决方案资源管理器中删除嵌套在 .ts 中的文件),然后重命名.ts文件,然后重新编译,.js文件用新名称重新生成,并自动添加到项目中(只要.ts文件已经存在).

I've found that if you delete the associated .js file and any source map (that is, delete the files nested inside the .ts in Solution Explorer), then rename the.ts file, then recompile, the .js files are regenerated with the new name, and are automatically added to the project (as long as the .ts file already is).

我应该补充一点,我已经安装了 WebEssentials - 我不知道这种行为有多少是因为那个,有多少是 VS 原生的.

I should add that I have WebEssentials installed - I don't know how much of this behaviour is due to that, and how much is native to VS.

这篇关于重命名打字稿文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆