Categorygithub.com/nathan-osman/pongo2-embed-loader

# README

pongo2-embed-loader

Build Status Coverage Status Go Report Card Go Reference MIT License

pongo2 provides Django-like templates for Go applications. However, it does not provide native support for the new embed directive introduced in Go 1.16. This package aims to fill that gap by providing a TemplateLoader for embedded files.

Usage

The package is extremely easy to use.

Assuming you have a directory named templates in the current source directory, you can create a template set with:

import "github.com/nathan-osman/pongo2-embed-loader"

//go:embed templates/*
var content embed.FS

templateSet := pongo2.NewSet("", &loader.Loader{Content: content})

You can then retrieve a template with:

t, err := templateSet.FromFile("templates/file.tpl")

# Packages

No description provided by the author