1
0
Fork 0
hugo/internal/js/esbuild/batch-esm-runner.gotmpl

21 lines
630 B
Plaintext

{{ range $i, $e := .Scripts -}}
{{ if eq .Export "*" }}
{{- printf "import %s as Script%d from %q;" .Export $i .Import -}}
{{ else -}}
{{- printf "import { %s as Script%d } from %q;" .Export $i .Import -}}
{{ end -}}
{{ end -}}
{{ range $i, $e := .Runners }}
{{- printf "import { %s as Run%d } from %q;" .Export $i .Import -}}
{{ end -}}
{{ if .Runners -}}
let group = { id: "{{ $.ID }}", scripts: [] }
{{ range $i, $e := .Scripts -}}
group.scripts.push({{ .RunnerJSON $i }});
{{ end -}}
{{ range $i, $e := .Runners -}}
{{ $id := printf "Run%d" $i }}
{{ $id }}(group);
{{ end -}}
{{ end -}}