aboutsummaryrefslogtreecommitdiffhomepage
path: root/tpl/tplimpl/embedded/templates/_hugo/build/js/batch-esm-runner.gotmpl
diff options
context:
space:
mode:
Diffstat (limited to 'tpl/tplimpl/embedded/templates/_hugo/build/js/batch-esm-runner.gotmpl')
-rw-r--r--tpl/tplimpl/embedded/templates/_hugo/build/js/batch-esm-runner.gotmpl16
1 files changed, 16 insertions, 0 deletions
diff --git a/tpl/tplimpl/embedded/templates/_hugo/build/js/batch-esm-runner.gotmpl b/tpl/tplimpl/embedded/templates/_hugo/build/js/batch-esm-runner.gotmpl
new file mode 100644
index 000000000..e1b3b9bc3
--- /dev/null
+++ b/tpl/tplimpl/embedded/templates/_hugo/build/js/batch-esm-runner.gotmpl
@@ -0,0 +1,16 @@
+{{ range $i, $e := .Scripts -}}
+ {{ printf "import { %s as Script%d } from %q;" .Export $i .Import }}
+{{ end -}}
+{{ range $i, $e := .Runners }}
+ {{ printf "import { %s as Run%d } from %q;" .Export $i .Import }}
+{{ end }}
+{{/* */}}
+let scripts = [];
+{{ range $i, $e := .Scripts -}}
+ scripts.push({{ .RunnerJSON $i }});
+{{ end -}}
+{{/* */}}
+{{ range $i, $e := .Runners }}
+ {{ $id := printf "Run%d" $i }}
+ {{ $id }}(scripts);
+{{ end }}