I've heard plenty of chatter about Sitecore Unicorn but never actually experienced a project that was utilizing it until recently. I was skeptical. Could it be as good as people make it out to be? I wanted to write a short post here describing my first impressions using it.
Before we talk about Unicorn though, let's talk a little about the past. If you've been in the Sitecore world awhile, you likely remember the days of relying solely on packages for moving templates/renderings/items into different environments. You might even have nightmares about those days (still). It was tedious. Team Development for Sitecore (TDS) eventually came along though and solved a lot of our problems. You could now check in item changes into source control and have them deploy during your environment builds. Code Generation was amazing as well. Syncing your templates and having code generation kick off automatically was a huge time saver.
There were some problems, though. TDS projects seem to make impact Visual Studio load times, code generation would often kick off when projects were loading and produce errors that wouldn't occur when you manually ran it again. Don't get me started on how long it takes to deploy to environments either, we'd often have "No TDS" builds by default just to avoid long build times.
I know some of these issues have been addressed by TDS but I think it's important to set the stage and describe where I'm coming from. I'm going to focus on Unicorn itself from here on out because as the Unicorn readme says, these two solutions solve some of the same problems, they just solve them differently and contain different feature sets.
So my first impression was... where is all the data? There wasn't a project to be found in the solution. That seemed like a good thing though because that would only slow down Visual Studio. After some exploring, I found a Data folder with the same structure as the Sitecore tree and all of the synced items were in YAML files that are generated using Rainbow serialization.
Syncing my first template
I just added a new field to a template for a new feature that I'm building out. How do I sync it without a project in Visual Studio facilitating that? Well, the answer to this is to use the "Serialize Tree" button on the developer toolbar in Sitecore itself. Serializing items has been in Sitecore for forever so it's great that it can be utilized here.
Serializing the template change will update the changed items that are under the current item you're on and Unicorn will update it's serialized files on disk. That's really it to get changes pulled down and ready to be checked in.
Non-existent in Unicorn. Unicorn really focuses on just one thing and that's syncing changes.
There are solutions though. This project that I'm working with utilizes Sitecore.CodeGenerator to build out Glass.Mapper models. It feels really familiar as well because Sitecore.CodeGenerator leverages T4 templates, which is the same thing TDS code generation supported. You can run these templates directly in Visual Studio. Another nice feature of the Sitecore.CodeGenerator project is that it can generate a file for each template you generate code for, so you don't end up with a single huge model class file.
They're, uh... fast. Two new build steps were added to the Jenkins builds that we deploy to different internal environments with. The first step just uses curl to make a request to the site to make sure it's come back after the file deployment and the next build step runs a powershell script that handles the deployment of items that Unicorn manages. I won't dive into detail but more information can be found in the "Automated Deployment" section in the Unicorn readme.
After working with Unicorn for a little bit, I have to admit that I'm pretty impressed so far. I think I'll miss having TDS projects in Visual Studio some but I'll overcome it. I love how fast deployments are with Unicorn. The workflow for syncing items into my local project is really fast and straight forward as well. TDS will still always have a spot in my heart for all the time it's saved me over the years though. It's been refreshing trying new technology though and is certainly worth evaluating to see if it could work well for your project.