28 November 2014

Configuration in SubFolder in the Include folder

I have been writing a previous post about the importance of Name for configuration files in the include folder. My usual habit was to prefix them with z. so all my custom files will be located at the last place (by alphabetical order). This means that those will be the last to be parsed which I can be sure to place any event or pipeline processor where I wanted. So my Include folder will looks like the following:

After reading a great post today from @jammykam, I wanted to share this:
You can create a folder and add all your custom files inside. From the Sitecore documentation (page 4), sitecore will first parse all the config file and then go recursively through subfolders:

When Sitecore reads the include files, it traverses the file system recursively. Sitecore first enumerates all the *.config files in the /App_Config/Include folder and then recursively enumerates all the sub-folders. You should take this order into account when you create sub-folders in the /App_Config/Include folder.
So creating a subfolder and moving the custom files inside will have the same effect than prefixing all my custom config:

No comments:

Post a Comment