简体   繁体   English

显示通过 Chrome 开发者工具所做的所有更改

[英]Show all changes made through Chrome Developer Tools

How do I display all changes which I made using Chrome Developer tools?如何显示我使用 Chrome 开发者工具所做的所有更改?

Example:例子:

  1. open a website.打开一个网站。
  2. open Chrome Developer Tool .打开Chrome 开发者工具
  3. change style attribute of a tag.更改标签的样式属性。
  4. add new style to some css file.向一些 css 文件添加新样式。
  5. change a JavaScript function.更改 JavaScript 函数。

How to see those changes?如何看到这些变化? Something like:就像是:

    page.html:56 Change style attribute of foo to bar.
    page.css:21 Lines added: 21,22,23,24.
    page.js:12 Line modified.

As of Chrome 65 there is a changes tab!!从 Chrome 65 开始,有一个更改选项卡!!

Yes really, it is amazing :)是的,真的,太棒了:)

Open Dev Tools > Ctrl+Shift+P > Show Changes打开开发工具 > Ctrl+Shift+P > Show Changes

https://developers.google.com/web/updates/2018/01/devtools#changes https://developers.google.com/web/updates/2018/01/devtools#changes

So, local modifications work for any changes to the files that you make, but they don't help you if you add inline styles or change your DOM in any way.因此,本地修改适用于您对文件所做的任何更改,但如果您添加内联样式或以任何方式更改 DOM,它们将无济于事。

I like to use a method where I capture the DOM before and after my changes.我喜欢使用一种方法,我可以在更改前后捕获 DOM。

copy(document.getElementsByTagName('html')[0].outerHTML)

That places the current state of the DOM into the copy buffer.这会将 DOM 的当前状态放入复制缓冲区。

Paste this in the left hand column of a diff tool like vimdiff, http://www.mergely.com/ or Meld.将此粘贴到 vimdiff、 http://www.mergely.com/或 Meld 等差异工具的左侧栏中。

Then I finish my modifications and run the copy command again.然后我完成我的修改并再次运行复制命令。 I paste that into the right hand column of the diff tool, then I can see my changes.我将其粘贴到差异工具的右侧栏中,然后我可以看到我的更改。

差异视图

Full article here: https://medium.com/@theroccob/get-code-out-of-chrome-devtools-and-into-your-editor-defaf5651b4a全文在这里: https : //medium.com/@theroccob/get-code-out-of-chrome-devtools-and-into-your-editor-defaf5651b4a

You may want to try the Local Modifications feature:您可能想尝试本地修改功能:

The DevTools also maintains a revision history of all changes made to local files. DevTools 还维护对本地文件所做的所有更改的修订历史记录。 If you've edited a script or stylesheet and saved changes using the Tools, you can right-click on a filename in Sources (or within the source area) and select "Local modifications" to view this history.如果您已编辑脚本或样式表并使用工具保存更改,您可以右键单击源中(或源区域内)中的文件名,然后选择“本地修改”以查看此历史记录。

在此处输入图片说明

Local modifications panel will appear displaying:本地修改面板将出现,显示:

  • A diff of the changes变化的差异
  • The time the change was made at更改时间
  • The domain under which a file was changed更改文件所在的域

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM