tmplrun

package module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2024 License: MIT Imports: 9 Imported by: 0

README

tmplrun

tmplrun is an open-source templating engine written in Go, designed to provide flexibility and simplicity in generating dynamic content for various applications. Tmplrun stands out by allowing the use of JavaScript within templates, thus enabling users to leverage the power and familiarity of JavaScript for templating purposes.

Features

  • JavaScript Templating: Utilize JavaScript directly within templates, eliminating the need for domain-specific template languages.
  • Extensibility: Easily extend tmplrun to support additional languages for templating purposes.
  • Command Line Interface: Integrated command-line tool for convenient template rendering.

Installation

CLI
go install github.com/connormckelvey/tmplrun/cmd/...
Library
go get github.com/connormckelvey/tmplrun

Usage

To render a template using tmplrun, you can use the command line interface:

tmplrun render -p path/to/props path/to/template

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RenderInput

type RenderInput struct {
	Entrypoint string         // Entrypoint is the path to the main template file.
	Props      map[string]any // Props contains the properties to be passed to the template.
}

RenderInput contains the input data required for rendering a template.

type TMPLRun

type TMPLRun struct {
	// contains filtered or unexported fields
}

TMPLRun represents a template runner that manages the rendering of templates.

func New

func New(fsys fs.FS) *TMPLRun

New creates a new instance of TMPLRun with the given filesystem.

func (*TMPLRun) Render

func (tr *TMPLRun) Render(w io.Writer, input *RenderInput) error

Render renders the template specified by the input and writes the result to the given writer.

Directories

Path Synopsis
cmd
internal
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL