feat: implement hero section using Pkl

This commit is contained in:
Prad Nukala
2024-09-30 21:16:13 -04:00
parent 3e9139bd58
commit 5f2e6c5dd4
14 changed files with 189 additions and 107 deletions
+1 -16
View File
@@ -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