Skip to content

Commit 3d80339

Browse files
authoredJan 14, 2025
fix: Kapa lazy load (#239)
* make gulp buld OS-safe * kapa lazy load * loads rapidoc differently
1 parent 9662a47 commit 3d80339

File tree

3 files changed

+32
-17
lines changed

3 files changed

+32
-17
lines changed
 

‎gulpfile.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,15 @@ const buildWasmTask = createTask({
6868
name: 'build:wasm',
6969
desc: 'Build the WebAssembly (.wasm) file using Go',
7070
call: (done) => {
71-
const command = `GOOS=js GOARCH=wasm go build -o ${wasmOutput} ${wasmMain}`
72-
exec(command, (err, stdout, stderr) => {
71+
const envVars = {
72+
...process.env, // preserve existing env vars
73+
GOOS: 'js',
74+
GOARCH: 'wasm',
75+
}
76+
77+
const command = `go build -o ${wasmOutput} ${wasmMain}`
78+
79+
exec(command, { env: envVars }, (err, stdout, stderr) => {
7380
if (err) {
7481
log.error('Error building wasm:', stderr)
7582
done(err)

‎src/layouts/swagger.hbs

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,20 @@
33
<head>
44
{{> head defaultPageTitle='API Reference'}}
55
<meta charset="utf-8">
6-
<script type="module" src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
6+
7+
<link rel="dns-prefetch" href="https://unpkg.com" />
8+
<link rel="preconnect" href="https://unpkg.com" crossorigin />
9+
<script type="module" defer src="https://unpkg.com/rapidoc/dist/rapidoc-min.js"></script>
10+
711
{{> header-scripts}}
812
<style>
913
td.tableblock>.content>: first-child {
1014
margin-top: 0;
1115
}
16+
17+
.rapidoc-container {
18+
min-height: 600px; /* avoid page jump */
19+
}
1220
</style>
1321
</head>
1422
<body style="padding-top:0; height:100vh;" class="api">

‎src/partials/head-scripts.hbs

+14-14
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,6 @@ j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
3030
<script>
3131
var uiRootPath="{{{uiRootPath}}}"
3232
</script>
33-
<script defer
34-
src="https://widget.kapa.ai/kapa-widget.bundle.js"
35-
data-website-id="fe00d579-9e9a-4f83-8f9f-0ca7672262a6"
36-
data-project-name="Redpanda"
37-
data-project-color="#E14225"
38-
data-modal-override-open-class="custom-class-kapa"
39-
data-modal-open-on-command-k="true"
40-
data-button-hide="true"
41-
data-modal-size="800px"
42-
data-project-logo="https://avatars.githubusercontent.com/u/49406389?s=200&v=4"
43-
data-user-analytics-fingerprint-enabled="true"
44-
data-user-analytics-store-ip="true"
45-
data-modal-disclaimer="This is a custom LLM for Redpanda with access to all developer docs, API specs, support FAQs, YouTube tutorials, and resolved GitHub discussions."
46-
></script>
4733
{{#if (ne page.attributes.role 'bloblang-playground')}}
4834
<link rel="stylesheet" href="{{{uiRootPath}}}/css/vendor/prism/prism.min.css">
4935
<!-- Prism scripts for code blocks -->
@@ -59,4 +45,18 @@ data-modal-disclaimer="This is a custom LLM for Redpanda with access to all deve
5945
<script defer src="{{{uiRootPath}}}/js/vendor/ace/worker-json.js"></script>
6046
<script src="{{{uiRootPath}}}/js/vendor/wasm_exec.js"></script>
6147
{{/if}}
48+
<script async
49+
src="https://widget.kapa.ai/kapa-widget.bundle.js"
50+
data-website-id="fe00d579-9e9a-4f83-8f9f-0ca7672262a6"
51+
data-project-name="Redpanda"
52+
data-project-color="#E14225"
53+
data-modal-override-open-class="custom-class-kapa"
54+
data-modal-open-on-command-k="true"
55+
data-button-hide="true"
56+
data-modal-size="800px"
57+
data-project-logo="https://avatars.githubusercontent.com/u/49406389?s=200&v=4"
58+
data-user-analytics-fingerprint-enabled="true"
59+
data-user-analytics-store-ip="true"
60+
data-modal-disclaimer="This is a custom LLM for Redpanda with access to all developer docs, API specs, support FAQs, YouTube tutorials, and resolved GitHub discussions."
61+
></script>
6262

0 commit comments

Comments
 (0)