From b2cddf73d7fd52e24749c6be5736a934dc1e5d02 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Fri, 30 Apr 2021 11:22:30 +0530 Subject: [PATCH] fix: Wrap html templates in template literals --- esbuild/frappe-html.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/esbuild/frappe-html.js b/esbuild/frappe-html.js index 9edd6b627a..8c4b7ca3d7 100644 --- a/esbuild/frappe-html.js +++ b/esbuild/frappe-html.js @@ -20,7 +20,7 @@ module.exports = { .then(content => { content = scrub_html_template(content); return { - contents: `\n\tfrappe.templates['${filename}'] = '${content}';\n` + contents: `\n\tfrappe.templates['${filename}'] = \`${content}\`;\n` }; }) .catch(() => { @@ -38,7 +38,6 @@ module.exports = { }; function scrub_html_template(content) { - content = content.replace(/\s/g, " "); - content = content.replace(/()/g, ""); - return content.replace("'", "'"); // eslint-disable-line + content = content.replace(/`/g, "\\`"); + return content; }