mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feat: implement hero section using Pkl
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
)
|
||||
|
||||
type Models struct {
|
||||
Hero *Hero `pkl:"hero"`
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Models
|
||||
@@ -26,22 +27,6 @@ func LoadFromPath(ctx context.Context, path string) (ret *Models, err error) {
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// LoadFromURL loads the pkl module at the given URL and evaluates it into a Models
|
||||
func LoadFromURL(ctx context.Context, url string) (ret *Models, err error) {
|
||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
cerr := evaluator.Close()
|
||||
if err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
ret, err = Load(ctx, evaluator, pkl.UriSource(url))
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Models
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Models, error) {
|
||||
var ret Models
|
||||
|
||||
Reference in New Issue
Block a user