From 8702db03fb155891abf7795156a8f7cc56809f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Lef=C3=A8vre?= Date: Tue, 24 Jan 2023 14:12:29 +0100 Subject: [PATCH] [FIX] tools: allow to pre-compile templates with - in their name Compiling a template with a dash ("-") in its name generates an invalid function name in the compiled code. A template named `"my-component"` leads to the function `function my-component(app, bdom, helpers) { ... }` which has an invalid name. closes #1333 --- tools/compile_xml.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/compile_xml.js b/tools/compile_xml.js index 40f657b6..9ca81ab2 100644 --- a/tools/compile_xml.js +++ b/tools/compile_xml.js @@ -48,7 +48,7 @@ function writeToFile(filepath, data) { } // adapted from https://medium.com/@mhagemann/the-ultimate-way-to-slugify-a-url-string-in-javascript-b8e4a0d849e1 -const a = "·_,:;"; +const a = "·-_,:;"; const p = new RegExp(a.split("").join("|"), "g"); function slugify(str) {