![]() In addition to being able to run an entire snippet, you can select just a portion of the code and execute it. Read more about snippets on the Chrome developer tools documentation.įirefox Scratchpad is really cool for experimenting with code. They are enabled by default in Canary, so this feature set will soon be widely available. Browser Supportįirefox has multiline support using the scratchpad editor, and Chrome has a new ‘snippets’ feature.Ĭurrently, in Chrome you have to enable snippets support in chrome://flags and inside of devtools settings (see full instructions and screenshots). Plus you can save it when you are done in case you need it later. For example, if you wrote something to help export information from a page, or print out some debugging data for your application, you can use the multiline snippet editing interface rather than typing in the console. Examples of this type of snippet would be adding jQuery to a page without it or printing the HTTP headers from the current page.Īnother use would be saving console commands that you use during development. ![]() Snippets are a much better way to handle this workflow. Then you would need to make changes to a giant single line of JavaScript inside of a bookmark manager, or use a generator to convert a. You may need to show a bookmarks bar in the UI, run it, and open up devtools to see if it worked. The problem with bookmarklets is that they are a pain to create and share, and even using them can be difficult. The actual snippets can be seen here: Why would you use snippetsĪ common usage for snippets is to replace developer bookmarklet type of functionality. You can jump straight to the devtools snippets project page and readme if you want to see some screenshots and details about each individual snippet. ![]() I have been working on a small collection of snippets that are handy to reuse inside of browser devtools.
0 Comments
Leave a Reply. |