Documentation ¶
Overview ¶
Dependency management for web resources like JS, CSS and other files.
Index ¶
- func Walk(m Module, ext string, fn WalkFunc) error
- type FileSet
- func (fs *FileSet) Mkdir(fullPath string, mode os.FileMode) *FileSet
- func (fs *FileSet) MkdirAll(fullPath string, mode os.FileMode) *FileSet
- func (fs *FileSet) Name() string
- func (fs *FileSet) Open(fullPath string) (http.File, error)
- func (fs *FileSet) Requires() []interface{}
- func (fs *FileSet) String() string
- func (fs *FileSet) WriteFile(fullPath string, mode os.FileMode, modTime time.Time, contents []byte) *FileSet
- func (fs *FileSet) WriteGzipFile(fullPath string, mode os.FileMode, modTime time.Time, contents []byte) *FileSet
- type Module
- type ModuleList
- type WalkFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FileSet ¶
type FileSet struct {
// contains filtered or unexported fields
}
FileSet implements Module and makes it easy to add file contents.
func NewFileSet ¶
func (*FileSet) Mkdir ¶
Mkdir creates a directory. It must not already exists but its parents must, will panic otherwise. Readdir() will return files and directories in the sequence they are created.
func (*FileSet) MkdirAll ¶
Mkdir creates a directory and all its parents. For directories that already exist this is a nop.
func (*FileSet) WriteFile ¶
func (fs *FileSet) WriteFile(fullPath string, mode os.FileMode, modTime time.Time, contents []byte) *FileSet
WriteFile creates a file. It must not already exists but its parents must, will panic otherwise. The modTime argument is included because it is useful to indicate the original build time of the file. Readdir() will return files and directories in the sequence they are created.
func (*FileSet) WriteGzipFile ¶
func (fs *FileSet) WriteGzipFile(fullPath string, mode os.FileMode, modTime time.Time, contents []byte) *FileSet
WriteGzipFile works the same as WriteFile except it expects contents to be gzipped and will gunzip them when reading. Allows you to reduce the size of the in-memory and on-disk representation of this file.
type Module ¶
type Module interface { http.FileSystem Name() string Requires() []interface{} }
Module interface describes a webresource module with a name (matching the Go import path), an http.FileSystem with it's contents, and slice of other Modules that this one requires. By convention the Module instance for a particular package can be obtained by calling that package's top level Module() function.
type ModuleList ¶
type ModuleList []Module
ModuleList is a Module slice with some useful methods.
func Resolve ¶
func Resolve(r ModuleList) ModuleList
Resolve walks the dependency tree for the resources provided and returns a ModuleList in the correct sequence according to dependency rules. The order of the input list is not important, the same input set will always result in the same output.
func (ModuleList) Len ¶
func (p ModuleList) Len() int
func (ModuleList) Named ¶
func (l ModuleList) Named(name string) Module
func (ModuleList) String ¶
func (l ModuleList) String() string
Strings outputs the "%s" of each Module on its own line with the final newline trimmed.
func (ModuleList) Swap ¶
func (p ModuleList) Swap(i, j int)
Directories ¶
Path | Synopsis |
---|---|
Demo of webresource - run a server with bootstrap and requirements.
|
Demo of webresource - run a server with bootstrap and requirements. |