Saving Design Changes from Internet Explorer to Visual Studio 2013

How many times as a web developer did you make a change to a web application in your browser and were disappointed when the changes didn’t update back within Visual Studio? With the recent updates to Mads Kristensen’s VS Web Essentials, you can. The Web Essentials download is a VSIX package (Visual Studio Extension).

To use it, open an existing project or create a new one. For purposes of this blog post, I created a new ASP.NET Web Application and used the MVC project template. The default project template has a master layout file that contains an ActionLink Html Helper with the first value being set as “Application name.”

   1: <body>

   2:     <div class="navbar navbar-inverse navbar-fixed-top">

   3:         <div class="container">

   4:             <div class="navbar-header">

   5:                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">

   6:                     <span class="icon-bar"></span>

   7:                     <span class="icon-bar"></span>

   8:                     <span class="icon-bar"></span>

   9:                 </button>

  10:                 @Html.ActionLink("Application name", "Index", "Home", null, new { @class = "navbar-brand" })

  11:             </div>

This is the display text that will be shown in the upper, left-hand corner of the default template as shown in the image below:


However, we may not have known where that value had come from or may want to tweak it when running our application. When we press F5 in Visual Studio, our application will run in the browser. If we press the Ctrl key, we’ll notice a new toolbar appear like shown below:


You’ll notice that I have checked the box for F12 auto-sync. This means that if I make any changes within the design of the page, it will sync back to Visual Studio. If we enter the developer tools (F12 in Internet Explorer) and expand the DOM to this element, we’ll see the text in F12 will show ‘Application name’ as shown below:


If we press the Web Essentials Design link, and click on that text, we can change it to something such as ‘Web Essentials ‘. Notice that while we are editing the text, the F12 screen changes the value as we are typing.


Back in Visual Studio, we’ll see the change in the layout file as such:


Notice how the tool is intelligent enough to make the change to the HTML Helper and not replace the code with a value.

This tool works for more than text changes. It also works for styles, classes, and other markup within the page.

Leave a Reply

Your email address will not be published. Required fields are marked *