monk

package module
v0.0.0-...-658dbba Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2014 License: MIT Imports: 15 Imported by: 0

README

monk

Sprockets-compatible asset pipeline in Go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendFilter

func AppendFilter(extension string, filter AssetProcessor)

func ApplyFilter

func ApplyFilter(context *Context, content string, extension string) (string, error)

func Build

func Build(r *Resolution, context *Context) string

TODO should return an error

func GenerateFingerprint

func GenerateFingerprint(fs fileSystem, path string) (string, error)

This function is not safe to call concurrently.

func Get

func Get(assetPath string) (string, error)

Get the asset specified by assetPath.

Types

type Asset

type Asset struct {
	os.FileInfo
	Content      string
	Dependencies []string
}

type AssetFilter

type AssetFilter struct{}

func (AssetFilter) CheckSystem

func (af AssetFilter) CheckSystem() error

func (AssetFilter) RequireBin

func (af AssetFilter) RequireBin(bin string) error

type AssetProcessor

type AssetProcessor interface {
	Process(context *Context, content string, extension string) (string, error)
	CheckSystem() error
}

type CachedFile

type CachedFile struct {
	// contains filtered or unexported fields
}

func (CachedFile) Close

func (cf CachedFile) Close() error

func (CachedFile) Read

func (cf CachedFile) Read(p []byte) (int, error)

func (CachedFile) Readdir

func (cf CachedFile) Readdir(count int) ([]os.FileInfo, error)

func (CachedFile) Seek

func (cf CachedFile) Seek(offset int64, whence int) (int64, error)

func (CachedFile) Stat

func (cf CachedFile) Stat() (os.FileInfo, error)

type CachedFileInfo

type CachedFileInfo struct {
	// contains filtered or unexported fields
}

func (CachedFileInfo) IsDir

func (f CachedFileInfo) IsDir() bool

func (CachedFileInfo) ModTime

func (f CachedFileInfo) ModTime() time.Time

func (CachedFileInfo) Mode

func (f CachedFileInfo) Mode() os.FileMode

func (CachedFileInfo) Name

func (f CachedFileInfo) Name() string

func (CachedFileInfo) Size

func (f CachedFileInfo) Size() int64

func (CachedFileInfo) Sys

func (f CachedFileInfo) Sys() interface{}

type CoffeeFilter

type CoffeeFilter struct {
	AssetFilter
}

func (CoffeeFilter) CheckSystem

func (cf CoffeeFilter) CheckSystem() error

func (CoffeeFilter) Process

func (cf CoffeeFilter) Process(context *Context, content string, extension string) (string, error)

type Config

type Config struct {
	Fingerprint bool
	AssetRoot   string
}

Config holds various configuration options used throughout a Context and its collaborators.

func NewConfig

func NewConfig() *Config

type Context

type Context struct {
	Store       map[string]*Asset
	SearchPaths []string
	Config      *Config
	// contains filtered or unexported fields
}

func NewContext

func NewContext(fs fileSystem) *Context

func (*Context) SearchPath

func (c *Context) SearchPath(dirpath string) (*Context, error)

Append a path to the list of asset paths to be searched for assets.

type DiskFS

type DiskFS struct{}

DiskFS implements fileSystem using the local disk.

func (DiskFS) Open

func (DiskFS) Open(name string) (file, error)

func (DiskFS) ReadDir

func (DiskFS) ReadDir(name string) ([]os.FileInfo, error)

func (DiskFS) ReadFile

func (DiskFS) ReadFile(name string) ([]byte, error)

func (DiskFS) Stat

func (DiskFS) Stat(name string) (os.FileInfo, error)

type LessFilter

type LessFilter struct {
	AssetFilter
}

func (LessFilter) CheckSystem

func (lf LessFilter) CheckSystem() error

func (LessFilter) Process

func (lf LessFilter) Process(context *Context, content string, extension string) (string, error)

type LocalCache

type LocalCache struct{}

func (*LocalCache) Open

func (lc *LocalCache) Open(name string) (file http.File, err error)

type Resolution

type Resolution struct {
	Resolved []string
	Seen     []string
}

func (*Resolution) Resolve

func (r *Resolution) Resolve(assetPath string, context *Context) error

Resolve the asset at assetPath and its dependencies.

type TemplateFilter

type TemplateFilter struct{}

func (TemplateFilter) CheckSystem

func (tf TemplateFilter) CheckSystem() error

func (TemplateFilter) Process

func (tf TemplateFilter) Process(context *Context, content string, extension string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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