assets

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(
	logger log.Event,
	dirPath string,
	cacheDirective string,
	notFoundFn http.HandlerFunc,
	debugMode bool) http.HandlerFunc

Handle is a function which automatically discovers, bundles and minifies static web assets such as CSS and JavaScript files and returns a http.HandlerFunc to deal with all web requests to those assets.

Types

type Asset

type Asset struct {
	FullPath    string
	ContentType string
}

Asset represents a single asset.

type Assets

type Assets struct {
	CSS   *Bundle
	JS    *Bundle
	Files map[string]Asset
}

Assets contains all static web assets.

func Get

func Get() *Assets

Get returns an object of all bundled and minified assets.

type Bundle

type Bundle struct {
	FileName string
	Contents []byte
}

Bundle represents multiple assets bundled together.

Jump to

Keyboard shortcuts

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