engine

package
v0.0.0-...-20b307e Latest Latest
Warning

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

Go to latest
Published: May 28, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JSExtension   = "js"
	JsonExtension = "json"
	HTMLExtension = "html"
)
View Source
const (
	PathAlreadyInUse      = "Path %s is already being in use"
	TemplateNotFound      = "Template %s not found"
	AssetNotFound         = "Asset %s not found"
	ScriptNotFound        = "Script %s not found"
	ScriptIsNotAGoPackage = "Script %s is not a go package"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	WebPagePath    string
	FileSystemPath string
}

type Assets

type Assets map[string]Asset

func LoadAssets

func LoadAssets(location, outputFolder string) (Assets, error)

type ContentGenerator

type ContentGenerator func(engine *Engine) ([]byte, error)

type Engine

type Engine struct {
	Templates Templates
	Scripts   Scripts
	Assets    Assets
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(templates Templates, scripts Scripts, assets Assets) *Engine

func (*Engine) AssetURL

func (engine *Engine) AssetURL(asset string) (string, error)

func (*Engine) Generate

func (engine *Engine) Generate(output string) error

func (*Engine) HandlePath

func (engine *Engine) HandlePath(newPath string, loader ContentGenerator) error

func (*Engine) MinifyHTML

func (engine *Engine) MinifyHTML(content []byte) ([]byte, error)

func (*Engine) MinifyJS

func (engine *Engine) MinifyJS(content []byte) ([]byte, error)

func (*Engine) MinifyJson

func (engine *Engine) MinifyJson(content []byte) ([]byte, error)

func (*Engine) RenderTemplate

func (engine *Engine) RenderTemplate(template_ string, symbolMap map[string]string) ([]byte, error)

func (*Engine) ScriptURL

func (engine *Engine) ScriptURL(script string) (string, error)

type Script

type Script struct {
	WebPagePath string
	PackagePath string
}

type Scripts

type Scripts map[string]Script

func LoadScripts

func LoadScripts(location, output string) (Scripts, error)

type Templates

type Templates map[string]string

func LoadTemplates

func LoadTemplates(location string) (Templates, error)

Jump to

Keyboard shortcuts

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