Update source file when CSS is changed through Chrome developer tools

橙三吉。 提交于 2019-12-03 03:50:23

I just learnt that it is possible. Here are the instructions (or view this page for up-to-date instructions):

  • Open Chrome Developer Tools
  • Click on Settings icon (the icon at the top right corner of dev tools)
  • Click on Workspace tab
  • Click on Add folder button and choose the local folder that contains the desired files (e.g. C:\www\project\)
  • If a warning appears, click Allow

Next step:

  • Open the desired webpage (e.g. http://localhost/project/)
  • Open the Sources tab in dev tools
  • Open the Navigator panel if necessary (it is the left column in sources tab, click left triangle icon just below the top left corner of dev tools to open it)
  • Scroll down to the bottom of the list where you will find the workspace folder added earlier
  • Expand the folder and locate the desired file (e.g. css/styles.css)
  • Right click on the file and choose Map to network resource...
  • A list will popup that shows a complete or filtered list of files loaded by the webpage
  • Choose the URL that corresponds to the selected local file (e.g. http://localhost/project/css/styles.css)
  • When a warning appears about restarting dev tools, click OK

Now you can:

  • Inspect an element and edit its CSS, the changes will be saved to local file immediately
  • Edit a mapped file in source panel, the changes will be saved to local file when you Save the file
  • Edit a mapped file in you favorite editor outside chrome; when you switch back to Chrome it will reload the file/update the styles automatically

There is a feature in chrome which adresses this issue.

Here: http://www.html5rocks.com/en/tutorials/developertools/revolutions2013/

you can read something about, how the network correspondes with your local machine and autosave the changes you make in chrome.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!