74. Custom Backends

74.1. Storing Multiple Templates

Custom templates can be stored in multiple directories. That means you can build on an existing backend by copying only the templates you want to modify. Then, just pass both the directory holding the original templates and the directory containing your customized templates when you invoke Asciidoctor.

In the CLI, multiple template directories are specified by using the -T option multiple times.

$ asciidoctor -T /path/to/original/templates -T /path/to/modified/templates mysample.adoc

In the API, multiple template directories are specified by passing an array to the template_dirs option:

Asciidoctor.convert_file 'mysample.adoc', safe: :safe
    template_dirs: %w(/path/to/original/templates /path/to/modified/templates)