feat(legal): minify imprint HTML when building

This commit is contained in:
2026-08-01 13:48:29 +02:00
committed by jakob.scheid
parent f2f6df67b8
commit d1c128ee49
+9 -1
View File
@@ -14,6 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import { minify } from 'html-minifier-terser';
import MarkdownIt from 'markdown-it'; import MarkdownIt from 'markdown-it';
import { mkdir, readFile, writeFile } from 'node:fs/promises'; import { mkdir, readFile, writeFile } from 'node:fs/promises';
@@ -23,6 +24,13 @@ export default async function build () {
const legalNoticeMd = await readFile('./src/legal/legal_notice.md', { encoding: 'utf-8' }); const legalNoticeMd = await readFile('./src/legal/legal_notice.md', { encoding: 'utf-8' });
const legalNoticeHtml = md.render(legalNoticeMd); const legalNoticeHtml = md.render(legalNoticeMd);
const legalNoticeHtmlMinified = await minify(legalNoticeHtml, {
collapseWhitespace: true,
conservativeCollapse: true,
collapseInlineTagWhitespace: true,
removeComments: true
});
return { return {
artifacts: [ artifacts: [
{ {
@@ -30,7 +38,7 @@ export default async function build () {
path: 'legal/legal_notice.html', path: 'legal/legal_notice.html',
type: 'text', type: 'text',
options: { options: {
content: legalNoticeHtml, content: legalNoticeHtmlMinified,
encoding: 'utf-8' encoding: 'utf-8'
} }
} }