package create
import "github.com/gohugoio/hugo/resources/resource_factories/create"
Package create contains functions for to create Resource objects. This will typically non-files.
Index ¶
- type Client
- func New(rs *resources.Spec) *Client
- func (c *Client) ByType(tp string) resource.Resources
- func (c *Client) Copy(r resource.Resource, targetPath string) (resource.Resource, error)
- func (c *Client) FromOpts(opts Options) (resource.Resource, error)
- func (c *Client) FromRemote(uri string, optionsm map[string]any) (resource.Resource, error)
- func (c *Client) FromString(targetPath, content string) (resource.Resource, error)
- func (c *Client) Get(pathname string) (resource.Resource, error)
- func (c *Client) GetMatch(pattern string) (resource.Resource, error)
- func (c *Client) Match(pattern string) (resource.Resources, error)
- type HTTPError
- type Options
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client contains methods to create Resource objects. tasks to Resource objects.
func New ¶
New creates a new Client with the given specification.
func (*Client) ByType ¶
func (*Client) Copy ¶
Copy copies r to the new targetPath.
func (*Client) FromOpts ¶
FromOpts creates a new Resource from the given Options. Make sure to set optis.TargetPathHasHash if the TargetPath already contains a hash, as this avoids the need to calculate it. To create a new ReadSeekCloser from a string, use hugio.NewReadSeekerNoOpCloserFromString, or hugio.NewReadSeekerNoOpCloserFromBytes for a byte slice. See FromString.
func (*Client) FromRemote ¶
FromRemote expects one or n-parts of a URL to a resource If you provide multiple parts they will be joined together to the final URL.
func (*Client) FromString ¶
FromString creates a new Resource from a string with the given relative target path.
func (*Client) Get ¶
Get creates a new Resource by opening the given pathname in the assets filesystem.
func (*Client) GetMatch ¶
GetMatch gets first resource matching the given pattern from the assets filesystem.
func (*Client) Match ¶
Match gets the resources matching the given pattern from the assets filesystem.
type HTTPError ¶
type HTTPError struct { Data map[string]any StatusCode int Body string // contains filtered or unexported fields }
type Options ¶
type Options struct { // The target path relative to the publish directory. // Unix style path, i.e. "images/logo.png". TargetPath string // Whether the TargetPath has a hash in it which will change if the resource changes. // If not, we will calculate a hash from the content. TargetPathHasHash bool // The content to create the Resource from. CreateContent func() (func() (hugio.ReadSeekCloser, error), error) }
Source Files ¶
- Version
- v0.144.2 (latest)
- Published
- Feb 19, 2025
- Platform
- linux/amd64
- Imports
- 35 packages
- Last checked
- 13 hours ago –
Tools for package owners.