From 985f21bdc73b5d2d1e991ae12db1ad39472d0941 Mon Sep 17 00:00:00 2001 From: Daniel Roe Date: Tue, 20 Jun 2023 12:27:42 +0100 Subject: [PATCH] feat(templates): add spa-loading-icon --- packages/ui-templates/lib/render.ts | 8 ++++- .../templates/spa-loading-icon/index.html | 29 +++++++++++++++++++ .../templates/spa-loading-icon/messages.json | 1 + 3 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 packages/ui-templates/templates/spa-loading-icon/index.html create mode 100644 packages/ui-templates/templates/spa-loading-icon/messages.json diff --git a/packages/ui-templates/lib/render.ts b/packages/ui-templates/lib/render.ts index 1a84819a1b..a409023f2f 100644 --- a/packages/ui-templates/lib/render.ts +++ b/packages/ui-templates/lib/render.ts @@ -33,8 +33,9 @@ export const RenderPlugin = () => { // Read source template let html = await fsp.readFile(fileName, 'utf-8') + const isCompleteHTML = html.includes('') - // Apply criters to inline styles + // Apply critters to inline styles html = await critters.process(html) // We no longer need references to external CSS html = html.replace(/]*>/g, '') @@ -63,6 +64,11 @@ export const RenderPlugin = () => { // Minify HTML html = htmlMinifier.minify(html, { collapseWhitespace: true }) + if (!isCompleteHTML) { + html = html.replace('', '') + html = html.replace('', '') + } + // Load messages const messages = JSON.parse(await fsp.readFile(r(`templates/${templateName}/messages.json`), 'utf-8')) diff --git a/packages/ui-templates/templates/spa-loading-icon/index.html b/packages/ui-templates/templates/spa-loading-icon/index.html new file mode 100644 index 0000000000..c698cfc761 --- /dev/null +++ b/packages/ui-templates/templates/spa-loading-icon/index.html @@ -0,0 +1,29 @@ + + + + diff --git a/packages/ui-templates/templates/spa-loading-icon/messages.json b/packages/ui-templates/templates/spa-loading-icon/messages.json new file mode 100644 index 0000000000..0967ef424b --- /dev/null +++ b/packages/ui-templates/templates/spa-loading-icon/messages.json @@ -0,0 +1 @@ +{}