fx

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2026 License: Unlicense Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(data []byte) []byte

Compress gzip-compresses data at maximum compression. Bundles are compressed once at build time and served directly with Content-Encoding: gzip.

func Wire added in v0.10.3

func Wire(values []*Value) []byte

Types

type Attr

type Attr map[string]string

Attr is a map of HTML attribute key-value pairs passed to any element builder.

type Forge

type Forge interface {
	HTML(raw string) *Frame
	Build(class string, elements ...*Frame)
	Builder(class string, elements ...*Frame) *Frame
	Frames(frame ...*Frame) [][]byte
	Markdown() *markdown.Markdown
	JS(js string) *Frame
	CSS(css string) *Frame
	Elem(tag, text string, attrs ...Attr) *Frame
	Block(tag string, attrs Attr, children ...*Frame) *Frame
	Void(tag string, attrs Attr) *Frame
}

func NewForge

func NewForge() Forge

type Frame added in v0.10.4

type Frame template.HTML

type Fx

type Fx struct {
	*zero.Zero
	Forge
	Routes map[string][]byte
}

func NewFx

func NewFx(z *zero.Zero) *Fx

func (*Fx) Load

func (fx *Fx) Load(path string)

Load reads a file or directory at path, encodes and compresses the contents, and stores the bundle in Routes keyed by the base name of path. Raw data is freed from each Value after the bundle is stored.

func (*Fx) ToBytes

func (fx *Fx) ToBytes(input string) ([]byte, error)

ToBytes fetches the content at input, either from an HTTP URL or a local file.

type Value

type Value struct {
	Name string `json:"name,omitempty"`
	Type string `json:"type,omitempty"`
	Size uint32 `json:"size"`
	Data []byte `json:"-"`
}

Value is the unit of work for encoding. Name and Type populate the manifest; Data is the raw blob. Data is excluded from JSON and freed after encoding.

Jump to

Keyboard shortcuts

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