Ver a proveniência

fix: Wrap html templates in template literals

version-14
Faris Ansari há 4 anos
ascendente
cometimento
b2cddf73d7
1 ficheiros alterados com 3 adições e 4 eliminações
  1. +3
    -4
      esbuild/frappe-html.js

+ 3
- 4
esbuild/frappe-html.js Ver ficheiro

@@ -20,7 +20,7 @@ module.exports = {
.then(content => { .then(content => {
content = scrub_html_template(content); content = scrub_html_template(content);
return { return {
contents: `\n\tfrappe.templates['${filename}'] = '${content}';\n`
contents: `\n\tfrappe.templates['${filename}'] = \`${content}\`;\n`
}; };
}) })
.catch(() => { .catch(() => {
@@ -38,7 +38,6 @@ module.exports = {
}; };


function scrub_html_template(content) { 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;
} }

Carregando…
Cancelar
Guardar