WebMatrix 2 Beta - All About Extensions
WebMatrix 2 has been rebuilt with extensibility in mind. We have designed it to allow developers to write MEF based extensions that integrate into the WebMatrix experience. Members of the WebMatrix team have individually published some initial extensions and David Anson has a great blog post talking about how to develop your own WebMatrix 2 extensions.
This post will describe the current list of extensions in the WebMatrix 2 extensions gallery. I recommend trying them out and sharing your feedback on the forums!
Image Viewer
The Image Viewer extension enables users to view images within the WebMatrix 2 editor. Usually, WebMatrix will just defer to Windows to open and show images, but now they will be hosted within their own editor tab in your website.
Image Viewer takes advantage of the WebMatrix editor extensibility and hosts an image renderer within the tab.
Snippets
If you ever find yourself cutting and pasting the same code over and over then this extension is for you. Snippets allows users to build up a library of code snippets that they frequently use and then exposes them in a handy ribbon button to paste them in when you need them.
On first launch, you will need to click the instruction drop down to set things up:
After you follow the instructions and restart WebMatrix, you’ll have full access to the snippet library you created!
Snippets uses the WebMatrix editor extensibilty to insert text at the current caret position. It also uses the ribbon and command manager extensibility to show the actions within the WebMatrix 2 ribbon.
Color Theme Manager
Editor personalization is usually a number one item on a developer’s mind when they move to a new tool. With the Color Theme Manager, users can now fully customize their editor all the way down to individual languages.
The Color Theme Manager also has the ability to import and export WebMatrix editor themes. If you really like your theme and want to share it with the community you can export it to an XML file. Users can easily reimport their theme changes from the load button on the ribbon.
Again, Color Theme manager uses the WebMatrix editor extensibility to manage the editor display text. It also uses the built in WebMatrix dialog to fully integrate into the overall WebMatrix user experience. The WebMatrix dialog just hosts the extension’s XAML user control and seamlessly displays it as if it was designed specifically for WebMatrix.
Image Optimizer
The Image Optimizer extension helps with compressing a website’s collection of images to allow for faster loading in slow connection and mobile scenarios. Once you install Image Optimizer you can right-click on any folder in the WebMatrix Files Workspace that contains images and click “Optimize folder images”. Quick word of warning, the files will be replaced after this action succeeds. If you have photos or other images that you don’t want to be optimized, make sure that you have them backed up somewhere!
Image Optimizer uses the tree view contextual extensibility. It inserts its own command when conditions are met. This is another great extensibility point for file manipulation that doesn’t require editing.
Azure Backup
If you are using Azure and you want to quickly backup your site’s file contents to the cloud, Azure Backup is a great utility. It takes all of your file contents, zips them and then convert the zip file to an Azure File Blob in the cloud. All you need is your account name and your Azure Primary Access Key.
Azure Backup uses ribbon extensibility, web application site service extensibility and the integrated dialog experience.
Zip Backup
This extension is a super lightweight tool to quickly backup your site’s content to a local folder on disk. Like Azure Backup, it takes all of the file contents, zips them and saves the zip to My Documents\MyWebSiteBackups. It is great for saving ASP.NET WebPages applications with SQL CE databases or applications that are primarily file based.
The Zip Backup Utility uses the same extensibility points as Azure Backup, but in addition it takes advantage of the WebMatrix notification bar to notify users when the action’s completed.
Summary
WebMatrix 2 has a great set of extensibility points. The extensions above just scratch the surface of what you can do with WebMatrix 2. Try them out today! We’d love to hear your feedback about them!