diff --git a/assets/js/main.js b/assets/js/main.js index 9ac34fb..f2e1809 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -20,6 +20,7 @@ window.hello2 = hello2; window.hello3 = hello3; window.hello4 = hello4; window.hello6 = hello6; +window.cwd = process.cwd; // Shim injected // TODO(bep) make this work in Hugo integration tests window.helloNodeModules = helloNodeModules; window.data = data; window.params = params; diff --git a/assets/js/shims/process.js b/assets/js/shims/process.js new file mode 100644 index 0000000..e0f77c6 --- /dev/null +++ b/assets/js/shims/process.js @@ -0,0 +1,3 @@ +export let process = { + cwd: () => 'shim cwd' +}; diff --git a/layouts/index.html b/layouts/index.html index 24c16bb..2d6357b 100644 --- a/layouts/index.html +++ b/layouts/index.html @@ -10,7 +10,8 @@ {{ end }} - {{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false "params" (dict "myparam" "Hugo Rocks!") ) }} + {{ $inject := slice "js/shims/process.js" }} + {{ $js := resources.Get "js/main.js" | js.Build (dict "minify" false "params" (dict "myparam" "Hugo Rocks!") "inject" $inject ) }} {{ partialCached "jslibs/alpinejs/script-src.html" "-" }} @@ -25,6 +26,7 @@