Skip to content

Blocks

The real magic of stencil is that its templates support blocks for extensibility points. As such, any file generated by the template can be a hybrid of user-maintained code and template-driven code. The template owner can evolve all of the code outside of the blocks, allowing their users to extend config, services, and business logic at prescribed points. If a template wants to change how CI or CD works, or change an observability system out from under its users, it's easy to do so just by changing template code. Then when your users re-run the templates, all of their business logic remains intact and they pick up the new templated reusable code that is traditionally considered annoying boilerplate -- your users quickly move into a world of worrying about their business logic and taking the boilerplate for granted.

Example

For examples of blocks, jump into the middle of our Guide to see them in action.