@vojtaholik/static-kit-core 2.1.5 → 2.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/config.ts +2 -0
- package/src/html-renderer.ts +12 -1
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -16,6 +16,8 @@ export const configSchema = z.object({
|
|
|
16
16
|
publicPath: z.string().default("/public"),
|
|
17
17
|
/** Dev server port */
|
|
18
18
|
devPort: z.number().default(3000),
|
|
19
|
+
/** HTML output format: "formatted" (pretty-printed) or "minified" */
|
|
20
|
+
htmlOutput: z.enum(["formatted", "minified"]).default("formatted"),
|
|
19
21
|
});
|
|
20
22
|
|
|
21
23
|
export type StaticKitConfig = z.infer<typeof configSchema>;
|
package/src/html-renderer.ts
CHANGED
|
@@ -184,9 +184,11 @@ export async function renderPage(
|
|
|
184
184
|
// Czech typography: non-breaking spaces after single-char prepositions
|
|
185
185
|
html = vlnaHtml(html);
|
|
186
186
|
|
|
187
|
-
//
|
|
187
|
+
// Dev mode: inject overlay. Production: strip dev attributes.
|
|
188
188
|
if (options.isDev) {
|
|
189
189
|
html = injectDevOverlay(html);
|
|
190
|
+
} else {
|
|
191
|
+
html = stripDevAttributes(html);
|
|
190
192
|
}
|
|
191
193
|
|
|
192
194
|
return html;
|
|
@@ -289,6 +291,15 @@ function setAttr(node: Node, name: string, value: string): void {
|
|
|
289
291
|
}
|
|
290
292
|
}
|
|
291
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Strip dev-only attributes (data-block-id, data-schema-address) from production HTML
|
|
296
|
+
*/
|
|
297
|
+
function stripDevAttributes(html: string): string {
|
|
298
|
+
return html
|
|
299
|
+
.replace(/\s+data-block-id="[^"]*"/g, "")
|
|
300
|
+
.replace(/\s+data-schema-address="[^"]*"/g, "");
|
|
301
|
+
}
|
|
302
|
+
|
|
292
303
|
/**
|
|
293
304
|
* Inject dev overlay script
|
|
294
305
|
*/
|