STENCIL

  • Docs
  • GitHub
Star

What's on this Page

  • Types of Modules
  • Creating a Module
  • More Information
MODULES

Stencil Modules

How to use Stencil Modules.

Stencil Modules are the core building blocks in Stencil.

Modules are used to create reusable grouping of templates and native extensions to be used by stencil.

Stencil Modules are powered by Go Modules and must be within a git repository. For more information about Go Modules, see:

  • https://github.com/golang/go/wiki/Modules
  • https://blog.golang.org/using-go-modules

Types of Modules

There are two types of module usable by stencil, a module and a native extension. A module may, itself, be only one of these types of modules.

Module

A module consists of templates in a templates/ directory in the root of the repository. Modules are written in the go template syntax with added functions and variables accessible to them at runtime. For more information about the module type see the basic module documentation.

Native Extensions

Native extensions are modules that run binary code, and generally are written in Go but may be written in any language that can implement a net/rpc interface. Native extensions are accessible via the extensions.Call "<importPath>.<functionName>" method. For more information about the native extension module type see the native extension module documentation.

Creating a Module

For information on how to create a module see the getting started documentation.

More Information

For more technical documentation on modules, see the below links.

  • About Stencil
    • What is Stencil?
    • License
  • Getting Started
    • Get Started Overview
    • Install Stencil
    • Quick Start
    • Module Quick Start
    • Native Extension Quick Start
  • Reference Docs
    • Reference Docs Overview
    • Stencil Modules Overview
    • Native Extensions
    • Template Module
    • Service Manifest
  • Functions
    • Functions Quick Reference
    • file.Block
    • file.Create
    • file.Delete
    • file.Path
    • file.RemoveAll
    • file.SetContents
    • file.SetPath
    • file.Skip
    • file.Static
    • stencil.AddToModuleHook
    • stencil.ApplyTemplate
    • stencil.Arg
    • stencil.Args
    • stencil.Exists
    • stencil.GetGlobal
    • stencil.GetModuleHook
    • stencil.ReadBlocks
    • stencil.ReadFile
    • stencil.SetGlobal
  • CLI
    • Commands Quick Reference
    • stencil
    • stencil create
    • stencil create module
    • stencil describe
    • stencil docs
    • stencil docs generate
    • stencil updater
    • stencil updater get-channel
    • stencil updater get-channels
    • stencil updater list-releases
    • stencil updater rollback
    • stencil updater set-channel
    • stencil updater status
    • stencil updater use
  • Contribute
    • Contribute to Stencil
    • Development
    • Documentation
  • Maintenance
Last updated: May 18, 2022: fix(bootstrap): v9.37.0 (#95) (f216eaa)
Improve this page
By the Stencil Authors
Hugo Logo
  • File an Issue
  • Get Help
  • Docs
  • GitHub
  • About Stencil
  • Getting Started
  • Reference Docs
  • Functions
  • CLI
  • Contribute
  • Maintenance