Skip to content

esskar/handlebars-contentprovider-filesystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Handlebars.ContentProvider.FileSystem Build Status

A file system based template content provider for Handlebars.Core.

Install

nuget install Handlebars.ContentProvider.FileSystem

Usage

var engine = new HandlebarsEngine();
engine.Configuration.TemplateContentProvider = new FileSystemTemplateContentProvider();

var template = engine.CompileView("foo.hbs");

To provide backward compatibility to the ViewEngine concept of the original Handlebars.Net library, you need to set PartialsSubPath:

var fileSystemTemplateContentProvider = new FileSystemTemplateContentProvider();
fileSystemTemplateContentProvider.PartialsSubPath = "partials";

This will allow you to keep your views to be in the /Views folder like so:

Views\layout.hbs                |<--shared as in \Views            
Views\partials\somepartial.hbs   <--shared as in \Views\partials
Views\{Controller}\{Action}.hbs 
Views\{Controller}\{Action}\partials\somepartial.hbs 

But it will also find partials if there are at the same level as the as the actual template file:

Views\layout.hbs           
Views\someotherpartial.hbs

Contributing

Pull requests are welcome! The guidelines are pretty straightforward:

  • Only add capabilities that are already in the Mustache / Handlebars specs
  • Avoid dependencies outside of the .NET BCL
  • Maintain cross-platform compatibility (.NET/Mono; Windows/OSX/Linux/etc)
  • Follow the established code format

About

***DEPRECATED*** A filesystem based template content provider for Handlebars for .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published