is there a way to save css/js changes of remote resource between page reloads or map remote resource to local in devtools?

前端 未结 10 2102
时光说笑
时光说笑 2020-12-06 09:50

I know about Workspaces recently introduced in DevTools but that is not that i need. For example: page uses jquery that is loaded from CDN, i modify jquery library code, pre

10条回答
  •  北海茫月
    2020-12-06 10:17

    Workspaces allow you to edit files mapped to a local directory - but naturally, a pre-requisite is to be serving local files.

    If you're playing with files you don't have direct/convenient access to (for whatever reason), I recommend setting up a tampering proxy like Burp. In a nutshell, you would be able to modify the server response and perform on-the-fly search and replace like cdn.example.com/jquery-library.js to localhost:8080/jquery-library.js in the html body. All you have to do afterwards is set up a local server (trivial) and edit the local instance of the script!

    This is a handy pattern to preview local changes against production content, as long as it's not used in lieu of a test environment.

提交回复
热议问题