Documentation
¶
Index ¶
- Constants
- Variables
- func ApplyManifestV2(m Manifest, f FlagsV2, do Stage) error
- func ExtToFn(ext string) (func([]byte) ([]byte, error), error)
- func ExtToMediaType(ext string) (string, error)
- func HookMinify(m map[string]MinifyFn) ssg.Hook
- func HookMinifyDefault(mediaTypes ssg.Set) ssg.Hook
- func HookReplacer(r Replaces) ssg.Hook
- func IndexGenerator(s *ssg.Ssg) ssg.Pipeline
- func IndexGeneratorModTime(s *ssg.Ssg) ssg.Pipeline
- func IndexGeneratorReverse(s *ssg.Ssg) ssg.Pipeline
- func IndexGeneratorTemplate(fnEntries func(entries []fs.FileInfo) []fs.FileInfo, ...) func(*ssg.Ssg) ssg.Pipeline
- func MinifyAll(path string, data []byte) ([]byte, error)
- func MinifyCss(og []byte) ([]byte, error)
- func MinifyFile(path string) ([]byte, error)
- func MinifyHtml(og []byte) ([]byte, error)
- func MinifyJs(og []byte) ([]byte, error)
- func MinifyJson(og []byte) ([]byte, error)
- func NewIndexGenerator(m IndexGeneratorMode) func(*ssg.Ssg) ssg.Pipeline
- type CopyTarget
- type CopyTargets
- type FlagsNoMinify
- type FlagsV2
- type IndexGeneratorMode
- type Manifest
- type MinifyFn
- type ReplaceTarget
- type Replaces
- type Site
- type Stage
Constants ¶
const ( MediaTypeHtml = "text/html" MediaTypeCss = "style/css" MediaTypeJs = "text/javascript" MediaTypeJson = "application/json" ExtHtml = ".html" ExtCss = ".css" ExtJs = ".js" ExtJson = ".json" )
const ( MarkerIndex string = "_index.soyweb" IndexGeneratorModeDefault IndexGeneratorMode = "" IndexGeneratorModeReverse IndexGeneratorMode = "reverse" IndexGeneratorModeModTime IndexGeneratorMode = "modtime" )
Variables ¶
var ErrWebFormatNotSupported = errors.New("unsupported web format")
Functions ¶
func ExtToMediaType ¶
func HookMinify ¶
func HookMinifyDefault ¶
func HookMinifyDefault(mediaTypes ssg.Set) ssg.Hook
func HookReplacer ¶
func HookReplacer(r Replaces) ssg.Hook
func IndexGenerator ¶
func IndexGenerator(s *ssg.Ssg) ssg.Pipeline
IndexGenerator returns an ssg.Pipeline that would look for marker file "_index.soyweb" within a directory.
Once it finds a marked directory, it inspects the children and generate a Markdown list with name index.md, which is later sent to supplied impl
func IndexGeneratorModTime ¶
func IndexGeneratorModTime(s *ssg.Ssg) ssg.Pipeline
IndexGeneratorModTime returns an index generator that sort index entries by ModTime returned by fs.FileInfo
func IndexGeneratorReverse ¶
func IndexGeneratorReverse(s *ssg.Ssg) ssg.Pipeline
IndexGeneratorReverse returns an index generator whose index list is populated reversed, i.e. descending alphanumerical sort
func IndexGeneratorTemplate ¶
func IndexGeneratorTemplate( fnEntries func(entries []fs.FileInfo) []fs.FileInfo, fnGenIndex func( ssgSrc string, ignore func(path string) bool, parent string, siblings []fs.FileInfo, template []byte, ) ( string, error, ), ) func(*ssg.Ssg) ssg.Pipeline
IndexGeneratorTemplate allows us to build an index generator pipeline from 2 components: 1. fnEntries - a function that intercepts entries and returns the actual entries to be used. This is useful when you want to implement some kind of entry filter, or just want to inspect entries before handling them over to the generators.
2. fnGenIndex - a function that is called for each marker _index.soyweb.
func MinifyFile ¶
func MinifyHtml ¶
func MinifyJson ¶
func NewIndexGenerator ¶
func NewIndexGenerator(m IndexGeneratorMode) func(*ssg.Ssg) ssg.Pipeline
Types ¶
type CopyTarget ¶
func (CopyTarget) String ¶
func (t CopyTarget) String() string
type CopyTargets ¶
type CopyTargets []CopyTarget
func (*CopyTargets) UnmarshalJSON ¶
func (c *CopyTargets) UnmarshalJSON(b []byte) error
type FlagsNoMinify ¶
type FlagsNoMinify struct {
NoMinifyHtmlGenerate bool `arg:"--no-min-html,env:NO_MIN_HTML" help:"Do not minify converted HTML outputs"`
NoMinifyHtmlCopy bool `arg:"--no-min-html-copy,env:NO_MIN_HTML_COPY" help:"Do not minify all copied HTML"`
NoMinifyCss bool `arg:"--no-min-css,env:NO_MIN_CSS" help:"Do not minify CSS files"`
NoMinifyJs bool `arg:"--no-min-js,env:NO_MIN_JS" help:"Do not minify Javascript files"`
NoMinifyJson bool `arg:"--no-min-json,env:NO_MIN_JSON" help:"Do not minify JSON files"`
}
func (FlagsNoMinify) Flags ¶
func (f FlagsNoMinify) Flags() FlagsV2
func (FlagsNoMinify) Skip ¶
func (f FlagsNoMinify) Skip(ext string) bool
type FlagsV2 ¶
type FlagsV2 struct {
NoCleanup bool `arg:"--no-cleanup" help:"Skip cleanup stage"`
NoCopy bool `arg:"--no-copy" help:"Skip scopy stage"`
NoBuild bool `arg:"--no-build" help:"Skip build stage"`
NoReplace bool `arg:"--no-replace" help:"Do not do text replacements defined in manifest"`
NoGenerateIndex bool `arg:"--no-gen-index" help:"Do not generate indexes on _index.soyweb"`
MinifyHtmlGenerate bool `arg:"--min-html" help:"Minify converted HTML outputs"`
MinifyHtmlCopy bool `arg:"--min-html-copy" help:"Minify all copied HTML"`
MinifyCss bool `arg:"--min-css" help:"Minify CSS files"`
MinifyJs bool `arg:"--min-js" help:"Minify Javascript files"`
MinifyJson bool `arg:"--min-json" help:"Minify JSON files"`
}
FlagsV2 represents CLI arguments that could modify soyweb behavior, such as skipping stages and minifying content of certain file extensions.
type IndexGeneratorMode ¶
type IndexGeneratorMode string
type Manifest ¶
func NewManifest ¶
type ReplaceTarget ¶
type Site ¶
type Site struct {
CleanUp bool `json:"-"` // Remove files in Copies before copying them
Copies map[string]CopyTargets `json:"-"`
GenerateIndex bool `json:"-"`
GenerateIndexMode IndexGeneratorMode `json:"-"`
Replaces Replaces `json:"-"`
// contains filtered or unexported fields
}
func (*Site) UnmarshalJSON ¶
type Stage ¶
type Stage int
const ( StageCollect Stage = -1 // These stages can be skipped StageCleanUp Stage = 1 << iota StageCopy StageBuild StageAll Stage = StageCollect | StageCleanUp | StageCopy | StageBuild )
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
minifier
command
|
|
|
soyweb
command
|
|
|
ssg-minifier
command
|
|
|
debug
|
|
|
debug-index-generator
command
|