Documentation ¶
Index ¶
- type Namespace
- func (ns *Namespace) Copy(s any, r resources.Resource) (resources.Resource, error)
- func (ns *Namespace) ExecuteAsTemplate(ctx context.Context, args ...any) (resources.Resource, error)
- func (ns *Namespace) Fingerprint(args ...any) (resources.Resource, error)
- func (ns *Namespace) Get(filename any) resources.Resource
- func (ns *Namespace) GetMatch(pattern any) resources.Resource
- func (ns *Namespace) Minify(r resources.Resource) (resources.Resource, error)
- func (ns *Namespace) ToCSS(args ...any) (resources.Resource, error)
- type Resource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Namespace ¶
type Namespace struct {
// contains filtered or unexported fields
}
Namespace provides template functions for the "resources" namespace.
func (*Namespace) ExecuteAsTemplate ¶
func (ns *Namespace) ExecuteAsTemplate(ctx context.Context, args ...any) (resources.Resource, error)
ExecuteAsTemplate creates a Resource from a Go template, parsed and executed with the given data, and published to the relative target path.
func (*Namespace) Fingerprint ¶
Fingerprint transforms the given Resource with a MD5 hash of the content in the RelPermalink and Permalink.
func (*Namespace) Get ¶
Get locates the filename given in Hugo's assets filesystem and creates a Resource object that can be used for further transformations.
func (*Namespace) GetMatch ¶
GetMatch finds the first Resource matching the given pattern, or nil if none found.
It looks for files in the assets file system.
See Match for a more complete explanation about the rules used.
type Resource ¶
type Resource interface { GetResource(pathname string) (resources.Resource, error) GetMatch(pattern string) (resources.Resource, error) Copy(r resources.Resource, targetPath string) (resources.Resource, error) Minify(r resources.Resource) (resources.Resource, error) ExecuteAsTemplate(ctx context.Context, res resources.Resource, targetPath string, data any) (resources.Resource, error) Fingerprint(res resources.Resource, algo string) (resources.Resource, error) ToCSS(res resources.Resource, args map[string]any) (resources.Resource, error) }