Javascript 如何转到 Chrome 开发者工具中的特定文件?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14608075/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-24 17:22:47  来源:igfitidea点击:

How to go to a specific file in Chrome Developer Tools?

javascriptdebugginggoogle-chromegoogle-chrome-devtoolsfrontend

提问by Alpha

I am developing a web application with a heavy front-end approach. By using Dojo and the AMD-way, I currently have testing screens which may easily load over a hundred different javascript files.

我正在使用大量前端方法开发 Web 应用程序。通过使用 Dojo 和 AMD 方式,我目前拥有可以轻松加载一百多个不同 javascript 文件的测试屏幕。

When I want to debug for any specific problem, or verify if I am seeing an old version of a specific file, I find it really hard to find my files in the Sources tab in the Chrome Developer Tools.

当我想调试任何特定问题,或验证我是否看到特定文件的旧版本时,我发现很难在 Chrome 开发人员工具的“源”选项卡中找到我的文件。

Is there any shortcut or action I can make that will let me type the name of a file and will take me to the source of that file?

是否有任何快捷方式或操作可以让我输入文件名并将我带到该文件的源?

回答by CD..

While in the sources tab use CTRL+O(?+Ofor Mac) to search scripts, stylesheets and snippets by filename.

在源选项卡中,使用CTRL+ O(Mac 为?+ O)按文件名搜索脚本、样式表和片段。

(use CTRL+SHIFT+Oto filter/navigate to a JavaScript function/CSS rule when viewing a file)

(使用CTRL+ SHIFT+O至滤波器/查看文件时,则定位到一个JavaScript功能/ CSS规则)

[Chrome Devtools Cheatsheet]

[ Chrome Devtools 速查表]

回答by Aleksei Mialkin

CTRL+ Pbrings up the search input in Windows.

CTRL+P在 Windows 中调出搜索输入。

enter image description here

在此处输入图片说明

?+ P— in Mac.

?+ P— 在 Mac 中。

enter image description here

在此处输入图片说明

回答by live-love

In Windows:

在 Windows 中:

Use CTRL+SHIFT+Fto search for content in files.

使用CTRL+ SHIFT+F来搜索文件中的内容。

Use CTRL+SHIFT+Oto search for file names.

使用CTRL+ SHIFT+O搜索文件名。

回答by Hymanie

Mac: Command + O Windows: Ctrl + O

Mac:Command + O Windows:Ctrl + O