Export CSS changes from inspector (webkit, firebug, etc)

前端 未结 14 1439
夕颜
夕颜 2020-12-07 10:08

When I\'m working with CSS, I\'ll often test in a browser - say, Chrome - right click an element, click Inspect Element, and edit the CSS right there. The use of arrow keys

相关标签:
14条回答
  • 2020-12-07 10:47

    To add an answer for Safari specifically — it's kind of possible.

    When you edit CSS in the Styles section in the Inspector for an existing CSS file, you can hit Cmd-S to re-save the entire file with the changes. However, if you're using a meta language like Sass / preprocessor / generating your CSS with bundling etc, I don't think this really solves that problem, though it may be possible with CSS source maps.

    When you edit CSS at the top of the Styles section, under Style Attribute to add inline styles (not tied to an existing CSS file), it doesn't seem possible to easily export all of those changes. For now, I'm just copying and pasting the overrides manually for each element.

    The official Apple docs are a little dated but found here: Web Inspector Tutorial - Editing Code to Change Your Webpage.

    0 讨论(0)
  • 2020-12-07 10:50

    I've suggested this product on SO before (I'm not affiliated with them in any way).

    http://www.skybound.ca/

    Excellent product. Sounds like exactly what you're looking for and much more.

    EDIT: Several other answers here have mentioned Google Chrome's ability to link to your local files (which is very very cool). Check out the other answers!

    0 讨论(0)
  • 2020-12-07 10:51

    With Workspaces you can have your CSS saved as you type them in your inspector (in Chrome). The problem is that every change is automatically saved and there's no way to disable this feature, as pointed in http://www.html5rocks.com/en/tutorials/developertools/revolutions2013/ and Disable automatic saving of CSS changes in Chrome Developer Tools.

    0 讨论(0)
  • 2020-12-07 10:52

    In Chrome, you can right-click a CSS file in the Sources tab and click "Local Modifications"

    This shows you all of your local changes. Each revision is timestamped and you can rollback to any previous revision.

    See the Live Editing and Revision History section of this tutorial.

    0 讨论(0)
  • 2020-12-07 10:53

    As mentioned by cloudworks, the answer to this has changed. This can now be accomplished rather well by the Chrome DevTools Autosave extension. This tool tracks CSS and JavaScript changes made within the Chrome Developer Tools console, and saves them back to local files. For instructions to install and setup the extension, please refer to the guide written by @addyosmani on his blog, here.

    enter image description here

    There is also a handy screencast which details the extension rather well.

    0 讨论(0)
  • 2020-12-07 10:57

    If you edit external CSS, then you can drag its latest revision out of the Resources panel into any text editor that supports DnD (see http://www.webkit.org/blog/1463/web-inspector-styles-enhanced/, the "Persisting Changes" section for more detail.) You can also revert your CSS changes to any earlier version of the stylesheet resource (in the right-click popup menu of any stylesheet revision.)

    0 讨论(0)
提交回复
热议问题