1

I'm trying to configure Sitecore Leprechaun to generate Glass models for my project, but no matter what I do, I can't seem to get it to work.

My project folder structure looks like:

/sitecore
     /unicorn (This is the root Unicorn serialization path)
          /Templates
/src
     /Code Generation
          /Leprechaun.config
     /MyProject.Domain (This is where I want the code generated)
     /MyProject.sln

I've tried a whole bunch of versions of Leprechaun.config, but no matter what I do, Leprechaun says I have 0 templates available.

Note: This project is NOT using a Helix architecture, all the templates will be contained in the Domain project.

Does anyone know what my Leprechaun.config file needs to look like to get this working?

1

In the Leprechaun.config file, there's an element called <templatePredicate ...>

by default, it's using Helix conventions:

<templatePredicate type="Leprechaun.Filters.StandardTemplatePredicate, Leprechaun" rootNamespace="$(layer).$(module)" singleInstance="true">
    <include name="Templates" path="/sitecore/templates/$(layer)/$(module)" />
</templatePredicate>

Since you aren't using a Helix architecture, let's pretend you have a folder in /sitecore/templates named "MyProject" where you store all your templates

you'd want to change the path the include to be:

<include name="Templates" path="/sitecore/templates/MyProject" />

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.