JeeShen Lee
JeeShen Lee

Reputation: 3826

How to exclude folder from Typewriter code generation

I'm using the settings below to include project "Soft.Data" in my Typewriter code generation.

But how do I exclude a specific folder (e.g. "ViewModels") from the code generation?

Template(Settings settings)
{
    settings.IncludeProject("Soft.Data");
    settings.OutputFilenameFactory = file => 
    {
        return $"{file.Name.Replace("ViewModel", "GenViewModel").Replace(".cs", ".ts")}";
    };        
}

Upvotes: 1

Views: 734

Answers (1)

frhagn
frhagn

Reputation: 533

You can use a lambda filter in your template to exclude a namespace.

${
    Template(Settings settings)
    {
        settings.IncludeProject("Soft.Data");
        settings.OutputFilenameFactory = file => 
        {
            return $"{file.Name.Replace("ViewModel", "GenViewModel").Replace(".cs", ".ts")}";
        };        
    }
}
$Classes(c => c.Namespace != "Soft.Data.ViewModels")[
...
]

Upvotes: 3

Related Questions