Documentation
¶
Index ¶
- Constants
- Variables
- func ClassifyType(t string) string
- func ColorGoToHexString(c color.Color) string
- func ContentReadSeekerCloser(r resources.Resource) (pio.ReadSeekCloser, error)
- func CreateVarsStyleSheet(vars map[string]any) string
- func DefaultExtension(f resources.ImageFormat) string
- func ImageFormatFromExt(ext string) (resources.ImageFormat, bool)
- func ImageFormatFromMediaSubType(sub string) (resources.ImageFormat, bool)
- func IsDartSassV2() bool
- func IsOpaque(img image.Image) bool
- func MediaType(f resources.ImageFormat) media.Type
- func RequiresDefaultQuality(f resources.ImageFormat) bool
- func ResolveComponent[T any](impPath string, resolve func(string) (v T, found, isDir bool)) (v T, found bool)
- func SetDartSassBinaryName()
- func SourcesFromSourceMap(s string) []string
- func SupportsTransparency(f resources.ImageFormat) bool
- func ToFilters(in any) []gift.Filter
- func UnwrapFilter(in gift.Filter) gift.Filter
- type BuildClient
- type Color
- type DartSassOptions
- type ErrorMessageResolved
- type ExternalOptions
- type FileCaches
- func (f FileCaches) AssetsCache() *filecache.Cache
- func (f FileCaches) Get(name string) *filecache.Cache
- func (f FileCaches) GetCSVCache() *filecache.Cache
- func (f FileCaches) GetJSONCache() *filecache.Cache
- func (f FileCaches) GetResourceCache() *filecache.Cache
- func (f FileCaches) ImageCache() *filecache.Cache
- type Filter
- type Filters
- func (*Filters) AutoOrient() gift.Filter
- func (*Filters) Brightness(percentage any) gift.Filter
- func (*Filters) ColorBalance(percentageRed, percentageGreen, percentageBlue any) gift.Filter
- func (*Filters) Colorize(hue, saturation, percentage any) gift.Filter
- func (*Filters) Contrast(percentage any) gift.Filter
- func (*Filters) Dither(options ...any) gift.Filter
- func (*Filters) Gamma(gamma any) gift.Filter
- func (*Filters) GaussianBlur(sigma any) gift.Filter
- func (*Filters) Grayscale() gift.Filter
- func (*Filters) Hue(shift any) gift.Filter
- func (*Filters) Invert() gift.Filter
- func (*Filters) Opacity(opacity any) gift.Filter
- func (*Filters) Overlay(src ImageSource, x, y any) gift.Filter
- func (*Filters) Padding(args ...any) gift.Filter
- func (*Filters) Pixelate(size any) gift.Filter
- func (*Filters) Process(spec any) gift.Filter
- func (*Filters) Saturation(percentage any) gift.Filter
- func (*Filters) Sepia(percentage any) gift.Filter
- func (*Filters) Sigmoid(midpoint, factor any) gift.Filter
- func (*Filters) Text(text string, options ...any) gift.Filter
- func (*Filters) UnsharpMask(sigma, amount, threshold any) gift.Filter
- type Giphy
- type Image
- type ImageConfig
- type ImageFilterFromOrientationProvider
- type ImageProcessSpecProvider
- type ImageProcessor
- func (p *ImageProcessor) ApplyFiltersFromConfig(src image.Image, conf ImageConfig) (image.Image, error)
- func (p *ImageProcessor) DecodeExif(r io.Reader) (*exif.ExifInfo, error)
- func (p *ImageProcessor) Filter(src image.Image, filters ...gift.Filter) (image.Image, error)
- func (p *ImageProcessor) FiltersFromConfig(src image.Image, conf ImageConfig) ([]gift.Filter, error)
- type ImageSource
- type ImportResolver
- type ImportResolverV1
- type InternalOptions
- type Options
- type PublishOnce
- type ResTransCtxBuilder
- func (b *ResTransCtxBuilder) Build() *ResourceTransformationCtx
- func (b *ResTransCtxBuilder) WithMediaType(m media.Type) *ResTransCtxBuilder
- func (b *ResTransCtxBuilder) WithSource(src pio.ReadSeekCloser) *ResTransCtxBuilder
- func (b *ResTransCtxBuilder) WithTargetPath(targetPath string) *ResTransCtxBuilder
- type ResourceHash
- type ResourceMetadata
- type ResourcePaths
- func (d ResourcePaths) FromTargetPath(targetPath string) ResourcePaths
- func (d ResourcePaths) Path() string
- func (d ResourcePaths) PathBaseDirLink() string
- func (d ResourcePaths) PathBaseDirTarget() string
- func (d ResourcePaths) PathDir() string
- func (d ResourcePaths) PathFile() string
- func (d ResourcePaths) PathTargetBasePaths() []string
- func (d ResourcePaths) TargetFilenames() []string
- func (d ResourcePaths) TargetLink() string
- func (d ResourcePaths) TargetPath() string
- func (d ResourcePaths) TargetPaths() []string
- type ResourceTransformationCtx
- func (ctx *ResourceTransformationCtx) AddOutPathIdentifier(identifier string)
- func (ctx *ResourceTransformationCtx) Close()
- func (ctx *ResourceTransformationCtx) ReplaceOutPathExtension(newExt string)
- func (ctx *ResourceTransformationCtx) SourcePath() string
- func (ctx *ResourceTransformationCtx) UpdateBuffer()
- func (ctx *ResourceTransformationCtx) UpdateSource()
- type ResourceTransformationKey
- type TransformationSource
- type TransformationTarget
Constants ¶
const ( ActionResize = "resize" ActionCrop = "crop" ActionFit = "fit" ActionFill = "fill" )
const ( NsHugoImport = "ns-hugo-imp" NsHugoImportResolveFunc = "ns-hugo-imp-func" )
const ( PrefixHugoVirtual = "__hu_v" PrefixHugoMemory = "__hu_m" )
const (
HugoVarsNamespace = "hugo:vars"
)
Variables ¶
var DartSassBinaryName string
Functions ¶
func ClassifyType ¶
func ColorGoToHexString ¶ added in v0.1.15
ColorGoToHexString converts a color.Color to a hex string.
func ContentReadSeekerCloser ¶
func ContentReadSeekerCloser(r resources.Resource) (pio.ReadSeekCloser, error)
ContentReadSeekerCloser returns a ReadSeekerCloser if possible for a given Resource.
func CreateVarsStyleSheet ¶
func DefaultExtension ¶
func DefaultExtension(f resources.ImageFormat) string
DefaultExtension returns the default file extension of this format, starting with a dot. For example: .jpg for resources.JPEG
func ImageFormatFromExt ¶
func ImageFormatFromExt(ext string) (resources.ImageFormat, bool)
func ImageFormatFromMediaSubType ¶
func ImageFormatFromMediaSubType(sub string) (resources.ImageFormat, bool)
func IsDartSassV2 ¶
func IsDartSassV2() bool
func IsOpaque ¶
IsOpaque returns false if the images has alpha channel and there is at least 1 pixel that is not (fully) opaque.
func MediaType ¶
func MediaType(f resources.ImageFormat) media.Type
MediaType returns the media type of this images, e.g. images/jpeg for resources.JPEG
func RequiresDefaultQuality ¶
func RequiresDefaultQuality(f resources.ImageFormat) bool
RequiresDefaultQuality returns if the default quality needs to be applied to images of this format.
func ResolveComponent ¶ added in v0.1.15
func ResolveComponent[T any](impPath string, resolve func(string) (v T, found, isDir bool)) (v T, found bool)
ResolveComponent resolves a component using the given resolver.
func SetDartSassBinaryName ¶
func SetDartSassBinaryName()
func SourcesFromSourceMap ¶ added in v0.1.15
Used in tests.
func SupportsTransparency ¶
func SupportsTransparency(f resources.ImageFormat) bool
SupportsTransparency reports whether it supports transparency in any form.
Types ¶
type BuildClient ¶ added in v0.1.15
BuildClient is a client for building JavaScript resources using esbuild.
func NewBuildClient ¶ added in v0.1.15
func NewBuildClient(fs resources.Fs, log loggers.Logger) *BuildClient
NewBuildClient creates a new BuildClient.
func (*BuildClient) Build ¶ added in v0.1.15
func (c *BuildClient) Build(opts Options) (api.BuildResult, error)
Build builds the given JavaScript resources using esbuild with the given options.
type Color ¶ added in v0.1.15
type Color struct {
// contains filtered or unexported fields
}
func (Color) ColorGo ¶ added in v0.1.15
ColorGo returns the color as a color.Color. For internal use only.
func (Color) ColorHex ¶ added in v0.1.15
ColorHex returns the color as a hex string prefixed with a #.
func (Color) Hash ¶ added in v0.1.15
For hashstructure. This struct is used in template func options that needs to be able to hash a Color. For internal use only.
func (Color) Luminance ¶ added in v0.1.15
Luminance as defined by w3.org. See https://www.w3.org/TR/WCAG21/#dfn-relative-luminance
type DartSassOptions ¶
type DartSassOptions struct { // Hugo, will by default, just replace the extension of the source // to .css, e.g. "scss/main.scss" becomes "scss/main.css". You can // control this by setting this, e.g. "styles/main.css" will create // a Resource with that as a base for RelPermalink etc. TargetPath string // Hugo automatically adds the entry directories (where the main.scss lives) // for project and themes to the list of include paths sent to LibSASS. // Any paths set in this setting will be appended. Note that these will be // treated as relative to the working dir, i.e. no include paths outside the // project/themes. IncludePaths []string // Default is nested. // One of nested, expanded, compact, compressed. OutputStyle string // When enabled, Hugo will generate a source map. EnableSourceMap bool // If enabled, sources will be embedded in the generated source map. SourceMapIncludeSources bool // Vars will be available in 'hugo:vars', e.g: // @use "hugo:vars"; // $color: vars.$color; Vars map[string]any }
func DecodeDartSassOptions ¶
func DecodeDartSassOptions(m map[string]any) (opts DartSassOptions, err error)
type ErrorMessageResolved ¶ added in v0.1.15
type ErrorMessageResolved struct { Path string Message string Content pio.ReadSeekCloser }
ErrorMessageResolved holds a resolved error message.
type ExternalOptions ¶ added in v0.1.15
type ExternalOptions struct { // If not set, the source path will be used as the base target path. // Note that the target path's extension may change if the target MIME type // is different, e.g. when the source is TypeScript. TargetPath string // Whether to minify to output. Minify bool // One of "inline", "external", "linked" or "none". SourceMap string SourcesContent bool // The language target. // One of: es2015, es2016, es2017, es2018, es2019, es2020 or esnext. // Default is esnext. Target string // The output format. // One of: iife, cjs, esm // Default is to esm. Format string // One of browser, node, neutral. // Default is browser. // See https://esbuild.github.io/api/#platform Platform string // External dependencies, e.g. "react". Externals []string // This option allows you to automatically replace a global variable with an import from another file. // The filenames must be relative to /assets. // See https://esbuild.github.io/api/#inject Inject []string // User defined symbols. Defines map[string]any // Maps a component import to another. Shims map[string]string // Configuring a loader for a given file type lets you load that file type with an // import statement or a require call. For example, configuring the .png file extension // to use the data URL loader means importing a .png file gives you a data URL // containing the contents of that image // // See https://esbuild.github.io/api/#loader Loaders map[string]string // User defined params. Will be marshaled to JSON and available as "@params", e.g. // import * as params from '@params'; Params any // What to use instead of React.createElement. JSXFactory string // What to use instead of React.Fragment. JSXFragment string // What to do about JSX syntax. // See https://esbuild.github.io/api/#jsx JSX string // Which library to use to automatically import JSX helper functions from. Only works if JSX is set to automatic. // See https://esbuild.github.io/api/#jsx-import-source JSXImportSource string // There is/was a bug in WebKit with severe performance issue with the tracking // of TDZ checks in JavaScriptCore. // // Enabling this flag removes the TDZ and `const` assignment checks and // may improve performance of larger JS codebases until the WebKit fix // is in widespread use. // // See https://bugs.webkit.org/show_bug.cgi?id=199866 // Deprecated: This no longer have any effect and will be removed. // TODO(bep) remove. See https://github.com/evanw/esbuild/commit/869e8117b499ca1dbfc5b3021938a53ffe934dba AvoidTDZ bool }
ExternalOptions holds user facing options for the js.Build template function.
func DecodeExternalOptions ¶ added in v0.1.15
func DecodeExternalOptions(m map[string]any) (ExternalOptions, error)
DecodeExternalOptions decodes the given map into ExternalOptions.
type FileCaches ¶
FileCaches is a named set of caches.
func (FileCaches) AssetsCache ¶
func (f FileCaches) AssetsCache() *filecache.Cache
AssetsCache gets the file cache for assets (processed resources, SCSS etc.).
func (FileCaches) Get ¶
func (f FileCaches) Get(name string) *filecache.Cache
Get gets a named cache, nil if none found.
func (FileCaches) GetCSVCache ¶
func (f FileCaches) GetCSVCache() *filecache.Cache
GetCSVCache gets the file cache for getCSV.
func (FileCaches) GetJSONCache ¶
func (f FileCaches) GetJSONCache() *filecache.Cache
GetJSONCache gets the file cache for getJSON.
func (FileCaches) GetResourceCache ¶
func (f FileCaches) GetResourceCache() *filecache.Cache
GetResourceCache gets the file cache for remote resources.
func (FileCaches) ImageCache ¶
func (f FileCaches) ImageCache() *filecache.Cache
type Filters ¶ added in v0.1.15
type Filters struct{}
func (*Filters) AutoOrient ¶ added in v0.1.15
AutoOrient creates a filter that rotates and flips an image as needed per its EXIF orientation tag.
func (*Filters) Brightness ¶ added in v0.1.15
Brightness creates a filter that changes the brightness of an image. The percentage parameter must be in range (-100, 100).
func (*Filters) ColorBalance ¶ added in v0.1.15
ColorBalance creates a filter that changes the color balance of an image. The percentage parameters for each color channel (red, green, blue) must be in range (-100, 500).
func (*Filters) Colorize ¶ added in v0.1.15
Colorize creates a filter that produces a colorized version of an image. The hue parameter is the angle on the color wheel, typically in range (0, 360). The saturation parameter must be in range (0, 100). The percentage parameter specifies the strength of the effect, it must be in range (0, 100).
func (*Filters) Contrast ¶ added in v0.1.15
Contrast creates a filter that changes the contrast of an image. The percentage parameter must be in range (-100, 100).
func (*Filters) Gamma ¶ added in v0.1.15
Gamma creates a filter that performs a gamma correction on an image. The gamma parameter must be positive. Gamma = 1 gives the original image. Gamma less than 1 darkens the image and gamma greater than 1 lightens it.
func (*Filters) GaussianBlur ¶ added in v0.1.15
GaussianBlur creates a filter that applies a gaussian blur to an image.
func (*Filters) Grayscale ¶ added in v0.1.15
Grayscale creates a filter that produces a grayscale version of an image.
func (*Filters) Hue ¶ added in v0.1.15
Hue creates a filter that rotates the hue of an image. The hue angle shift is typically in range -180 to 180.
func (*Filters) Invert ¶ added in v0.1.15
Invert creates a filter that negates the colors of an image.
func (*Filters) Opacity ¶ added in v0.1.15
Opacity creates a filter that changes the opacity of an image. The opacity parameter must be in range (0, 1).
func (*Filters) Overlay ¶ added in v0.1.15
func (*Filters) Overlay(src ImageSource, x, y any) gift.Filter
Overlay creates a filter that overlays src at position x y.
func (*Filters) Padding ¶ added in v0.1.15
Padding creates a filter that resizes the image canvas without resizing the image. The last argument is the canvas color, expressed as an RGB or RGBA hexadecimal color. The default value is `ffffffff` (opaque white). The preceding arguments are the padding values, in pixels, using the CSS shorthand property syntax. Negative padding values will crop the image. The signature is images.Padding V1 [V2] [V3] [V4] [COLOR].
func (*Filters) Pixelate ¶ added in v0.1.15
Pixelate creates a filter that applies a pixelation effect to an image.
func (*Filters) Process ¶ added in v0.1.15
Process creates a filter that processes an image using the given specification.
func (*Filters) Saturation ¶ added in v0.1.15
Saturation creates a filter that changes the saturation of an image.
func (*Filters) Sepia ¶ added in v0.1.15
Sepia creates a filter that produces a sepia-toned version of an image.
func (*Filters) Sigmoid ¶ added in v0.1.15
Sigmoid creates a filter that changes the contrast of an image using a sigmoidal function and returns the adjusted image. It's a non-linear contrast change useful for photo adjustments as it preserves highlight and shadow detail.
func (*Filters) Text ¶ added in v0.1.15
Text creates a filter that draws text with the given options.
func (*Filters) UnsharpMask ¶ added in v0.1.15
UnsharpMask creates a filter that sharpens an image. The sigma parameter is used in a gaussian function and affects the radius of effect. Sigma must be positive. Sharpen radius roughly equals 3 * sigma. The amount parameter controls how much darker and how much lighter the edge borders become. Typically between 0.5 and 1.5. The threshold parameter controls the minimum brightness change that will be sharpened. Typically between 0 and 0.05.
type Image ¶
type Image struct { ImageFormat resources.ImageFormat Spec pio.ReadSeekCloserProvider // contains filtered or unexported fields }
func NewImage ¶
func NewImage(f resources.ImageFormat, img image.Image, s pio.ReadSeekCloserProvider) *Image
func (*Image) InitConfig ¶
InitConfig reads the images config from the given reader.
type ImageConfig ¶
type ImageConfig struct { // This defines the output format of the output images. It defaults to the source format. TargetFormat resources.ImageFormat Action string // If set, this will be used as the key in filenames etc. Key string // Quality ranges from 1 to 100 inclusive, higher is better. // This is only relevant for JPEG and WEBP images. // Default is 75. Quality int // Rotate rotates an images by the given angle counter-clockwise. // The rotation will be performed first. Rotate int // Used to fill any transparency. // When set in site config, it's used when converting to a format that does // not support transparency. // When set per images operation, it's used even for formats that does support // transparency. BgColor color.Color BgColorStr string // Hint about what type of picture this is. Used to optimize encoding // when target is set to webp. Hint webpoptions.EncodingPreset Width int Height int Filter gift.Resampling FilterStr string Anchor gift.Anchor AnchorStr string // contains filtered or unexported fields }
ImageConfig holds configuration to create a new images from an existing one, resize etc.
func DecodeImageConfig ¶
func DecodeImageConfig(action string, options []string, defaults resources.ImageConfig, sourceFormat resources.ImageFormat) (ImageConfig, error)
func GetDefaultImageConfig ¶
func GetDefaultImageConfig(action string, defaults resources.ImageConfig) ImageConfig
func (ImageConfig) GetKey ¶
func (i ImageConfig) GetKey(format resources.ImageFormat) string
type ImageProcessSpecProvider ¶
type ImageProcessSpecProvider interface {
ImageProcessSpec() string
}
type ImageProcessor ¶
func (*ImageProcessor) ApplyFiltersFromConfig ¶
func (p *ImageProcessor) ApplyFiltersFromConfig(src image.Image, conf ImageConfig) (image.Image, error)
func (*ImageProcessor) DecodeExif ¶
func (*ImageProcessor) FiltersFromConfig ¶
func (p *ImageProcessor) FiltersFromConfig(src image.Image, conf ImageConfig) ([]gift.Filter, error)
type ImageSource ¶
ImageSource identifies and decodes an images.
type ImportResolver ¶
type ImportResolver struct { BaseDir string FsService resources.Fs DependencyManager identity.Manager VarsStylesheet godartsass.Import }
func (ImportResolver) CanonicalizeURL ¶
func (t ImportResolver) CanonicalizeURL(url string) (string, error)
func (ImportResolver) Load ¶
func (t ImportResolver) Load(url string) (godartsass.Import, error)
type ImportResolverV1 ¶
type ImportResolverV1 struct {
godartsass.ImportResolver
}
func (ImportResolverV1) Load ¶
func (t ImportResolverV1) Load(url string) (godartsassv1.Import, error)
type InternalOptions ¶ added in v0.1.15
type InternalOptions struct { MediaType media.Type OutDir string Contents string SourceDir string ResolveDir string AbsWorkingDir string Metafile bool StdinSourcePath string DependencyManager identity.Manager Stdin bool // Set to true to pass in the entry point as a byte slice. Splitting bool TsConfig string EntryPoints []string ImportOnResolveFunc func(string, api.OnResolveArgs) string ImportOnLoadFunc func(api.OnLoadArgs) string ImportParamsOnLoadFunc func(args api.OnLoadArgs) json.RawMessage ErrorMessageResolveFunc func(api.Message) *ErrorMessageResolved ResolveSourceMapSource func(string) string // Used to resolve paths in error source maps. }
InternalOptions holds internal options for the js.Build template function.
type Options ¶ added in v0.1.15
type Options struct { ExternalOptions InternalOptions // contains filtered or unexported fields }
Options holds the options passed to Build.
type PublishOnce ¶
type ResTransCtxBuilder ¶
type ResTransCtxBuilder struct { DepSvc resources.DependenceSvc PubSvc resources.PublishSvc // contains filtered or unexported fields }
func NewResourceTransformationCtxBuilder ¶
func NewResourceTransformationCtxBuilder(d resources.DependenceSvc, p resources.PublishSvc) *ResTransCtxBuilder
func (*ResTransCtxBuilder) Build ¶
func (b *ResTransCtxBuilder) Build() *ResourceTransformationCtx
func (*ResTransCtxBuilder) WithMediaType ¶
func (b *ResTransCtxBuilder) WithMediaType(m media.Type) *ResTransCtxBuilder
func (*ResTransCtxBuilder) WithSource ¶
func (b *ResTransCtxBuilder) WithSource(src pio.ReadSeekCloser) *ResTransCtxBuilder
func (*ResTransCtxBuilder) WithTargetPath ¶
func (b *ResTransCtxBuilder) WithTargetPath(targetPath string) *ResTransCtxBuilder
type ResourceHash ¶
func (*ResourceHash) Setup ¶
func (r *ResourceHash) Setup(l io.ReadSeekCloserProvider) error
type ResourceMetadata ¶
type ResourceMetadata struct { Target string `json:"Target"` MediaTypeV string `json:"MediaType"` MetaData map[string]any `json:"Data"` }
func (ResourceMetadata) Marshal ¶
func (r ResourceMetadata) Marshal() ([]byte, error)
func (ResourceMetadata) Unmarshal ¶
func (r ResourceMetadata) Unmarshal(data []byte) (ResourceMetadata, error)
type ResourcePaths ¶
type ResourcePaths struct { // This is the directory component for the target file or link. Dir string // Any base directory for the target file. Will be prepended to Dir. BaseDirTarget string // This is the directory component for the link will be prepended to Dir. BaseDirLink string // Set when publishing in a multihost setup. TargetBasePaths []string // This is the File component, e.g. "data.json". File string }
ResourcePaths holds path information for a resource. All directories in here have Unix-style slashes, with leading slash, but no trailing slash. Empty directories are represented with an empty string.
func NewResourcePaths ¶
func NewResourcePaths(targetPath string, svc resources.URLConfig) ResourcePaths
func (ResourcePaths) FromTargetPath ¶
func (d ResourcePaths) FromTargetPath(targetPath string) ResourcePaths
func (ResourcePaths) Path ¶
func (d ResourcePaths) Path() string
func (ResourcePaths) PathBaseDirLink ¶
func (d ResourcePaths) PathBaseDirLink() string
func (ResourcePaths) PathBaseDirTarget ¶
func (d ResourcePaths) PathBaseDirTarget() string
func (ResourcePaths) PathDir ¶
func (d ResourcePaths) PathDir() string
func (ResourcePaths) PathFile ¶
func (d ResourcePaths) PathFile() string
func (ResourcePaths) PathTargetBasePaths ¶
func (d ResourcePaths) PathTargetBasePaths() []string
func (ResourcePaths) TargetFilenames ¶
func (d ResourcePaths) TargetFilenames() []string
func (ResourcePaths) TargetLink ¶
func (d ResourcePaths) TargetLink() string
func (ResourcePaths) TargetPath ¶
func (d ResourcePaths) TargetPath() string
func (ResourcePaths) TargetPaths ¶
func (d ResourcePaths) TargetPaths() []string
type ResourceTransformationCtx ¶
type ResourceTransformationCtx struct { // The context that started the transformation. Ctx context.Context DepSvc resources.DependenceSvc PubSvc resources.PublishSvc Source *TransformationSource Target *TransformationTarget // Data data can be set on the transformed Resource. Not that this need // to be simple types, as it needs to be serialized to JSON and back. Data map[string]any // contains filtered or unexported fields }
func (*ResourceTransformationCtx) AddOutPathIdentifier ¶
func (ctx *ResourceTransformationCtx) AddOutPathIdentifier(identifier string)
AddOutPathIdentifier transforming InPath to OutPath adding an identifier, eg '.min' before any extension.
func (*ResourceTransformationCtx) Close ¶
func (ctx *ResourceTransformationCtx) Close()
func (*ResourceTransformationCtx) ReplaceOutPathExtension ¶
func (ctx *ResourceTransformationCtx) ReplaceOutPathExtension(newExt string)
ReplaceOutPathExtension transforming InPath to OutPath replacing the file extension, e.g. ".scss"
func (*ResourceTransformationCtx) SourcePath ¶
func (ctx *ResourceTransformationCtx) SourcePath() string
func (*ResourceTransformationCtx) UpdateBuffer ¶
func (ctx *ResourceTransformationCtx) UpdateBuffer()
func (*ResourceTransformationCtx) UpdateSource ¶
func (ctx *ResourceTransformationCtx) UpdateSource()
type ResourceTransformationKey ¶
type ResourceTransformationKey struct { Name string // contains filtered or unexported fields }
ResourceTransformationKey are provided by the different transformation implementations. It identifies the transformation (name) and its configuration (elements). We combine this in a chain with the rest of the transformations with the target filename and a content hash of the origin to use as cache key.
func NewResourceTransformationKey ¶
func NewResourceTransformationKey(name string, elements ...any) ResourceTransformationKey
NewResourceTransformationKey creates a new ResourceTransformationKey from the transformation name and elements. We will create a 64 bit FNV hash from the elements, which when combined with the other key elements should be unique for all practical applications.
func (ResourceTransformationKey) Value ¶
func (k ResourceTransformationKey) Value() string
Value returns the Key as a string. Do not change this without good reasons.
type TransformationSource ¶
type TransformationTarget ¶
type TransformationTarget struct { // The target of Content transformation. // The current implementation requires that r is written to w // even if no transformation is performed. To io.Writer // The relative target path to the transformed resource. Unix styled slashes. OutPath string // The media type of the transformed resource. OutMediaType media.Type }
Source Files
¶
- classify.go
- color.go
- dartsass.go
- filecache.go
- giphy.go
- hash.go
- image.go
- imageconfig.go
- imagedither.go
- imagefilter.go
- imagefilters.go
- imageformat.go
- imageopacity.go
- imageorient.go
- imageoverlay.go
- imagepadding.go
- imageprocess.go
- imageprocessor.go
- imageresizer.go
- imageservice.go
- imagetext.go
- importresolver.go
- jsbuild.go
- jsbuildoptions.go
- jsbuildresolve.go
- publishonce.go
- resourcemetadata.go
- resourcepaths.go
- sourcemap.go
- transformation.go
- transformationcontext.go
- transformationctxbuilder.go