https://github.com/esskar/handlebars-contentprovider-filesystem
***DEPRECATED*** A filesystem based template content provider for Handlebars for .NET
https://github.com/esskar/handlebars-contentprovider-filesystem
Last synced: 7 months ago
JSON representation
***DEPRECATED*** A filesystem based template content provider for Handlebars for .NET
- Host: GitHub
- URL: https://github.com/esskar/handlebars-contentprovider-filesystem
- Owner: esskar
- License: mit
- Created: 2017-05-08T02:48:38.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-05-09T05:27:45.000Z (about 9 years ago)
- Last Synced: 2025-08-01T07:08:49.579Z (12 months ago)
- Language: HTML
- Homepage:
- Size: 30.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Handlebars.ContentProvider.FileSystem [](https://travis-ci.org/esskar/handlebars-core)
A file system based template content provider for [Handlebars.Core](https://github.com/esskar/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](https://github.com/rexm/Handlebars.Net),
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