Documentation ¶
Overview ¶
Package goldsmith generates static websites.
Index ¶
- type Context
- func (self *Context) CreateFileFromAsset(sourcePath, dataPath string) (*File, error)
- func (self *Context) CreateFileFromReader(sourcePath string, reader io.Reader) (*File, error)
- func (self *Context) DispatchAndCacheFile(outputFile *File, inputFiles ...*File)
- func (self *Context) DispatchFile(file *File)
- func (self *Context) Filter(filters ...Filter) *Context
- func (self *Context) RetrieveCachedFile(outputPath string, inputFiles ...*File) *File
- func (self *Context) Threads(threads int) *Context
- type File
- func (self *File) CopyProps(file *File)
- func (self *File) Dir() string
- func (self *File) Ext() string
- func (self *File) GoString() string
- func (self *File) ModTime() time.Time
- func (self *File) Name() string
- func (self *File) Path() string
- func (self *File) Prop(name string) (Prop, bool)
- func (self *File) PropOrDefault(name string, valueDef Prop) Prop
- func (self *File) Props() PropMap
- func (self *File) Read(data []byte) (int, error)
- func (self *File) Rename(path string)
- func (self *File) Rewrite(reader io.Reader) error
- func (self *File) Seek(offset int64, whence int) (int64, error)
- func (self *File) SetProp(name string, value Prop)
- func (self *File) Size() int64
- func (self *File) WriteTo(writer io.Writer) (int64, error)
- type Filter
- type Finalizer
- type Goldsmith
- func (self *Goldsmith) Cache(cacheDir string) *Goldsmith
- func (self *Goldsmith) Chain(plugin Plugin) *Goldsmith
- func (self *Goldsmith) Clean(clean bool) *Goldsmith
- func (self *Goldsmith) End(targetDir string) []error
- func (self *Goldsmith) FilterPop() *Goldsmith
- func (self *Goldsmith) FilterPush(filter Filter) *Goldsmith
- type Initializer
- type Plugin
- type Processor
- type Prop
- type PropMap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context corresponds to the current link in the chain and provides methods that enable plugins to inject new files into the chain.
func (*Context) CreateFileFromAsset ¶
CreateFileFromAsset creates a new file instance from the provided file path.
func (*Context) CreateFileFromReader ¶
CreateFileFrom data creates a new file instance from the provided data buffer.
func (*Context) DispatchAndCacheFile ¶
DispatchAndCacheFile caches the file data (excluding the metadata), taking dependencies on any input files that are needed to generate it, and then passes it to the next link in the chain.
func (*Context) DispatchFile ¶
DispatchFile causes the file to get passed to the next link in the chain.
func (*Context) Filter ¶
Specify internal filter(s) that exclude files from being processed.
func (*Context) RetrieveCachedFile ¶
RetrieveCachedFile looks up file data (excluding the metadata), given an output path and any input files that are needed to generate it. The function will return nil if the desired file is not found in the cache.
type File ¶
type File struct {
// contains filtered or unexported fields
}
File represents in-memory or on-disk files in a chain.
func (*File) ModTime ¶
ModTime returns the time of the file's last modification.
func (*File) Path ¶
Path returns the file path relative to the source directory.
func (*File) Read ¶
Read reads file data into the provided buffer.
func (*File) Rename ¶
Rename modifies the file path relative to the source directory.
func (*File) Seek ¶
Seek updates the file pointer to the desired position.
type Filter ¶
Filter is used to determine which files should continue in the chain.
type Finalizer ¶
Finalizer allows for optional finalization of a plugin after all files queued in the chain have passed through it.
type Goldsmith ¶
type Goldsmith struct {
// contains filtered or unexported fields
}
Goldsmith chainable context.
func Begin ¶
Begin starts a chain, reading the files located in the source directory as input.
func (*Goldsmith) Cache ¶
Cache enables caching in cacheDir for the remainder of the chain.
func (*Goldsmith) Chain ¶
Chain links a plugin instance into the chain.
func (*Goldsmith) Clean ¶
Clean enables or disables removal of leftover files in the target directory.
func (*Goldsmith) End ¶
End stops a chain, writing all recieved files to targetDir as output.
func (*Goldsmith) FilterPop ¶
FilterPop pops a filter instance from the chain's filter stack.
type Initializer ¶
Initializer is used to optionally initialize a plugin and to specify a filter to be used for determining which files will be processed.
type Plugin ¶
type Plugin interface {
Name() string
}
Plugin contains the minimum set of methods required on plugins. Plugins can also optionally implement Initializer, Processor, and Finalizer interfaces.
type Processor ¶
Processor allows for optional processing of files passing through a plugin.
type Prop ¶
type Prop interface{}