# Bash-TPL - A smart, lightweight shell script templating engine

I know the landscape is crowded, but I'd like to offer my submission for an Easy To Use / Easy To Maintain template engine:

Introducing Bash-TPL : A Smart, lightweight shell script templating engine, written in Bash

* [https://github.com/TekWizely/bash-tpl](https://github.com/TekWizely/bash-tpl)

#### FEATURES

##### Lightweight

* Single bash script
* Easy to ship with your project or build process

##### Smart Indentation Tracking

* Removes unwanted whitespace from rendered text files
* Encourages well-formatted mix of template tags and textual content

##### Generates Reusable Shell Scripts

* Can manage & invoke shell scripts without bash-tpl
* Only need bash-tpl when your source templates change

##### Shell Agnostic

* Uses standard printf, variable, and sub-shell constructs
* Templates can target any modern shell

##### Supports Includes

* Can organize your templates as smaller, reusable components
* Indentation tracking even works across includes !

##### Flexible Delimiter Support

* Can customize all template delimiters
* Can modify delimiters mid-template
* Can include templates with differing delimiters

------------------
#### Quick Example

As is the way: A quintessential *hello world* example is of course in order:

*hello.tpl*

    Hello, <% ${NAME:-World} %>

*compile + run*

    $ source <( bash-tpl hello.tpl )
    
    Hello, World

*compile + run with NAME*

    $ NAME=TekWizely source <( bash-tpl hello.tpl )
    
    Hello, TekWizely

*view compiled template*

    $ bash-tpl hello.tpl
    
    printf "%s\n" Hello\,\ "${NAME:-World}"

---------------------
#### More Information

This hello example is really just the start of what bash-tpl can do.

There's a full README on the [Project Home Page](https://github.com/TekWizely/bash-tpl).

If you're looking for an easy solution for creating maintainable templates to generate well-formatted text files, I hope you'll give my project a try.

I'm happy to answer any questions or work through any use-cases you might have for templates and see how bash-tpl might help.

Feel free to comment and thanks for looking!

\-TW
