Self Contained Command Line Interface for working with handlebars templates
Handlebars CLI takes Handlebars Templates , and the Handlebars.net Rendering Engine to create a CLI tool for rendering your templates to the console or output files
You can either replace the templates in {ApplicationRoot}\Templates and {ApplicationRoot}\Templates\Views
or you can privide your own directories at the commandline
Short | Long | Default | Description |
---|---|---|---|
-d DATA | --data=DATA | Json Input for binding template, supports json only at this time | |
-b Path | --basedir=Path | CWD | Base directory to load templates from |
-v PATH, | --views=PATH | {{TemplateDirectory}}\Views | Directory to find view templates |
-i, | --input=PATH | Input data file, supports json only at this time | |
-v, | --verbose | false | Display detailed output |
-o, | --output | Console.Out | File path to output rendered text |
-h | --help | Display this help screen. | |
--version | Display version information. | ||
pos[0] NAME | Required | Template Name to use for output, ie pscomment.hbs |
For Handlebars Syntax support please see the handlebars website Here
Nuget Packaging is coming for the pugins sdk soon!
To create an external plugin create
- Create a class library project
- Install the Digitalparadox.HandlebarsCli.Plugins package
- Implement the IHandlebarsPlugin interface
public class MyPlugin : HandlebarsCli.Plugins.IHandlebarsHelper
{
public string Name { get; set; } = "HelloWorldHelperExample";
public HelperType Type { get; set; } = HelperType.Inline;
public string Execute(TextWriter writer, HelperOptions options, dynamic data, params object[] args)
{
return "Hello World!!";
}
}
-
Build and add .dll to .\Plugins Directory
-
Profit
- Fix Existing Bugs
- Stabilize /optimize rendering engine
- Add Support for directory initialization / project creation
- Add Support for adding views / templates / partials via command line
- Build out plugin system
- Build msi installer
- Add Chocolatey Support
- Add Support for writing helpers in .cs & .csx
- Helper installation support, Likely nuget based
I am open to contributions from the community
if you would like to see a feature added fork me and submit a pull request or open an issue
if you have built a plugin and would like to see it listed here open an issue with the title Add Plugin {Name} to listing